瀏覽代碼

few changes

Boris K 5 年之前
父節點
當前提交
71c7f6fc44

+ 4 - 4
.idea/workspace.xml

@@ -3,10 +3,10 @@
   <component name="ChangeListManager">
     <list default="true" id="a8a32a88-c432-4104-a927-0d3d1c1c21be" name="Default Changelist" comment="">
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/src/App.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/App.js" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/src/components/appointment/Appointment.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/appointment/Appointment.js" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/src/components/main/Main.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/main/Main.js" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/src/components/services/Services.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/services/Services.js" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/src/components/specialists/Doctors.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/specialists/Doctors.js" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/src/components/specialists/MoreInfo.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/specialists/MoreInfo.js" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/src/reducers/user.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/reducers/user.js" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/src/utils/formFields.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/utils/formFields.js" afterDir="false" />
     </list>
     <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
@@ -76,7 +76,7 @@
       <option name="presentableId" value="Default" />
       <updated>1562445740358</updated>
       <workItem from="1562445741612" duration="45849000" />
-      <workItem from="1566302661790" duration="666000" />
+      <workItem from="1566302661790" duration="3402000" />
     </task>
     <servers />
   </component>

+ 9 - 16
src/App.js

@@ -24,28 +24,15 @@ export class App extends React.Component {
         this.props.getDoctors();
         this.props.getServices();
         this.props.getCategories();
-        // this.props.getOrders();
 
        if(localStorage.getItem('userId')) this.props.getUser()
 
-       window.addEventListener = ( "hashchange", makeHashchange) 
+       window.addEventListener = ( "hashchange", makeHashchange)
 
-        // fetch ("https://api-clinics.herokuapp.com/api/v1/auth/login", {
-        //     method : "POST",
-        //     credentials: "include",
-        //     headers: {
-        //         "Content-Type": "application/json"
-        //     },
-        //     body: JSON.stringify ({
-        //         email: "test@test.com",
-        //         password: "qwerty"
-        //     })
-        // })
-        //     .then (res => res.json ())
-        //     .then (res => console.log (res))
     }
 
     render() {
+
         return (
               <Loader flag={this.props.app.isFetching}>
                   <Header/>
@@ -68,7 +55,13 @@ export class App extends React.Component {
 
 const mapStateToProps = state => {
     return {
-        app:state.app
+        app:state.app,
+        appoinLoad:state.appointment.isFetching,
+        ordersLoad:state.orders.isFetching,
+        appLoad:state.app.isFetching,
+        servicesLoad:state.services.isFetching,
+        userLoad:state.user.isFetching,
+        sheduleLoad:state.shedule.isFetching,
     }
 };
 

+ 7 - 4
src/components/appointment/Appointment.js

@@ -22,10 +22,12 @@ export class Appoint extends React.Component {
 
     componentDidMount() {
         this.props.setAppointmentDoctor(this.props.match.params.doctorId);
-        this.props.setAppointmentSpec({
-            data:this.props.match.params.serviceId,
-            services:this.props.services
-        })
+        if(this.props.match.params.serviceId !== 'false'){
+            this.props.setAppointmentSpec({
+                data:this.props.match.params.serviceId,
+                services:this.props.services
+            })
+        }
     }
 
     componentWillUnmount() {
@@ -75,6 +77,7 @@ export class Appoint extends React.Component {
         if (appointment.specId) {
             spec = services.find(el => el._id === appointment.specId)
         }
+        console.log(this.props)
         return (
             <>
                 <div className="main">

+ 1 - 1
src/components/specialists/MoreInfo.js

@@ -22,7 +22,7 @@ export class MoreInfo extends React.Component {
                                 <p className = "highlights">{doctor.profession}</p>
                                 <p className = "highlights">Опыт работы более {new Date().toISOString().split('T')[0].split('-')[0] - doctor.experience.split('T')[0].split('-')[0]}  лет</p>
                                 {doctor.skillsDescription.split ("<br>").map ( (el, index) => (  <p key= {index}> { el } </p>)  ) }
-                                 {match.params.flag === 'true' && <Link to={`/appointment/${doctor._id}`} className = "btn link">Записаться на приём</Link>}
+                                 {match.params.flag === 'true' && <Link to={`/appointment/${doctor._id}/false`} className = "btn link">Записаться на приём</Link>}
                              </div>
                         </div>
                     </div>}

+ 6 - 9
src/reducers/user.js

@@ -1,6 +1,6 @@
 import * as types from '../actionsTypes/actionsTypes'
 
-import {adminChangeUserForm, changeUserForm} from "../utils/formFields"
+import {adminChangeUserForm} from "../utils/formFields"
 
 const defaultState = {
     user: null,
@@ -81,7 +81,6 @@ export const userReducer = (state = defaultState, action) => {
 
         case types.FIND_USER_REQUEST_SUCCESS : {
             const data = state.findUserInput.includes('@') ? action.payload.users[0] : action.payload.user;
-            console.log(data)
             return {
                 ...state,
                 user: data,
@@ -99,17 +98,15 @@ export const userReducer = (state = defaultState, action) => {
                         }
                         : el.id === 'user' && data.doctor === false && data.role === false
                         ? {
-                                ...el,
+                            ...el,
                             defaultChecked: true,
-                            }
+                        }
                         : el
                 ),
                 error: action.payload.message,
-                access:data.role ? 'role' : data.doctor ? 'doctor' : 'user',
-                isFetching:
-                    false
-            }
-                ;
+                access: data.role ? 'role' : data.doctor ? 'doctor' : 'user',
+                isFetching: false
+            };
         }
 
         case types.FIND_USER_REQUEST_FAIL : {

+ 1 - 1
src/utils/formFields.js

@@ -418,7 +418,7 @@ export const route = [
   },
   {
     id: 7,
-    exact: false,
+    exact: true,
     path: "/appointment/:doctorId/:serviceId",
     protected: true,
     component: Appointment