vit9 5 vuotta sitten
vanhempi
commit
5f06ec4c6e

+ 11 - 11
src/actions/addNewStaffAction.js

@@ -2,31 +2,31 @@ import * as types from '../constants/actionTypes';
 
 const axios = require('axios')
 
-const addNewStaffRequest = payload =>({
+const addNewStaffRequest = payload => ({
     type: types.ADD_NEW_STAFF_REQUEST,
     payload
 })
-const addNewStaffRequestSuccess = payload =>({
+const addNewStaffRequestSuccess = payload => ({
     type: types.ADD_NEW_STAFF_REQUEST_SUCCESS,
     payload
 })
-const addNewStaffRequestFail = payload =>({
+const addNewStaffRequestFail = payload => ({
     type: types.ADD_NEW_STAFF_REQUEST_FAIL,
     payload
 })
 
-export const closeModal  = payload =>({
+export const closeModal = payload => ({
     type: types.CLOSE_MODAL_WINDOW,
     payload
 })
 
-export const AddNewStaff = payload =>{
-    return dispatch=>{
+export const AddNewStaff = payload => {
+    return dispatch => {
         dispatch(addNewStaffRequest())
-        axios.post(`http://127.0.0.1:2000/api/staffs`, payload )
-             .then(res => 
-                    setTimeout(() => dispatch(addNewStaffRequestSuccess(res)),1000))
-             .catch(err =>
-                    dispatch(addNewStaffRequestFail(err)))
+        axios.post(`http://127.0.0.1:2000/api/staffs`, payload)
+            .then(res =>
+                setTimeout(() => dispatch(addNewStaffRequestSuccess(res)), 1000))
+            .catch(err =>
+                dispatch(addNewStaffRequestFail(err)))
     }
 }

+ 11 - 9
src/actions/getStaffByIdAction.js

@@ -14,16 +14,18 @@ const StaffRequestFailById = payload => ({
 	type: types.STAFF_REQUEST_FAIL_BY_ID,
 	payload
 });
-export const getStaffsDataById = (payload)=>{
-    return dispatch => {
+export const getStaffsDataById = (payload) => {
+	return dispatch => {
 		dispatch(StaffRequestById());
 		return axios.get(`http://127.0.0.1:2000/api/staffs?id=${payload}`)
-                    .then(res => {
-                            setTimeout(()=>{dispatch(StaffRequestSuccessById(res))},Math.random()*1000);
-                        })
-                    .catch(err=>{
-                            dispatch(StaffRequestFailById(err));
-                    })    
-			
+			.then(res => {
+				setTimeout(() => {
+					dispatch(StaffRequestSuccessById(res))
+				}, Math.random() * 1000);
+			})
+			.catch(err => {
+				dispatch(StaffRequestFailById(err));
+			})
+
 	};
 };

+ 19 - 15
src/actions/searchStaffAction.js

@@ -1,36 +1,40 @@
-import  * as types from '../constants/actionTypes';
+import * as types from '../constants/actionTypes';
 
 const axios = require('axios');
 
 
 
-export const changeInputValue = payload =>({
+export const changeInputValue = payload => ({
     type: types.CHANGE_INPUT_VALUE,
     payload
 })
 
-const searchStaffRequest = payload =>({
+const searchStaffRequest = payload => ({
     type: types.SEARCH_STAFF_REQUEST,
     payload
 })
-const searchStaffRequestSuccess = payload =>({
+const searchStaffRequestSuccess = payload => ({
     type: types.SEARCH_STAFF_REQUEST_SUCCESS,
     payload
 })
-const searchStaffrequestFail = payload =>({
+const searchStaffrequestFail = payload => ({
     type: types.SEARCH_STAFF_REQUEST_FAIL,
     payload
 })
-export const searchStaff = payload =>{
-    return dispatch =>{
+export const searchStaff = payload => {
+    return dispatch => {
         dispatch(searchStaffRequest())
-            return axios.get(`http://127.0.0.1:2000/api/staffs?search=${payload}`)
-                    .then( 
-                        res=>{setTimeout(()=>{dispatch(searchStaffRequestSuccess(res))},1)
-                        })
-                    .catch(
-                        err=>{dispatch(searchStaffrequestFail(err))
-                        })    
-        
+        return axios.get(`http://127.0.0.1:2000/api/staffs?search=${payload}`)
+            .then(
+                res => {
+                    setTimeout(() => {
+                        dispatch(searchStaffRequestSuccess(res))
+                    }, 1)
+                })
+            .catch(
+                err => {
+                    dispatch(searchStaffrequestFail(err))
+                })
+
     }
 }

+ 12 - 10
src/actions/searchStaffByIdAction.js

@@ -1,4 +1,4 @@
-import  * as types from '../constants/actionTypes';
+import * as types from '../constants/actionTypes';
 
 
 
@@ -18,16 +18,18 @@ const SeacrhStaffRequestFailById = payload => ({
 	type: types.SEARCH_STAFF_REQUEST_FAIL_BY_ID,
 	payload
 });
-export const getSeacrhStaffsDataById = (payload)=>{
-    return dispatch => {
+export const getSeacrhStaffsDataById = (payload) => {
+	return dispatch => {
 		dispatch(SeacrhStaffRequestById());
 		return axios.get(`http://127.0.0.1:2000/api/staffs?id=${payload}`)
-                    .then(res => {
-                            setTimeout(()=>{dispatch(SeacrhStaffRequestSuccessById(res))},Math.random()*1000);
-                        })
-                    .catch(err=>{
-                            dispatch(SeacrhStaffRequestFailById(err));
-                    })    
-			
+			.then(res => {
+				setTimeout(() => {
+					dispatch(SeacrhStaffRequestSuccessById(res))
+				}, Math.random() * 1000);
+			})
+			.catch(err => {
+				dispatch(SeacrhStaffRequestFailById(err));
+			})
+
 	};
 };

+ 12 - 11
src/actions/staffsAction.js

@@ -20,17 +20,18 @@ const StaffRequestFail = payload => ({
 	type: types.STAFF_REQUEST_FAIL,
 	payload
 });
-export const getStaffsData = (payload)=>{
-    return dispatch => {
+export const getStaffsData = (payload) => {
+	return dispatch => {
 		dispatch(StaffRequest());
 		return axios.get(`http://127.0.0.1:2000/api/staffs`)
-                    .then(res => {
-                            setTimeout(()=>{dispatch(StaffRequestSuccess(res))},1000);
-                        })
-                    .catch(err=>{
-                            dispatch(StaffRequestFail(err));
-                    })    
-			
-	};
-};
+			.then(res => {
+				setTimeout(() => {
+					dispatch(StaffRequestSuccess(res))
+				}, 1000);
+			})
+			.catch(err => {
+				dispatch(StaffRequestFail(err));
+			})
 
+	};
+};

+ 3 - 3
src/actions/usersAuthActions.js

@@ -1,6 +1,6 @@
 import * as types from "../constants/actionTypes";
 
-const axios= require("axios");
+const axios = require("axios");
 
 const userAuthRequest = payload => ({
     type: types.USER_AUTH_REQUEST,
@@ -22,8 +22,8 @@ export const getUsersData = (payload) => {
         dispatch(userAuthRequest());
         return axios.get(`http://127.0.0.1:2000/api/users`)
             .then(res => {
-                 console.log(res);
-                })
+                console.log(res);
+            })
             .catch(err => {
                 dispatch(userAuthRequestFail(err));
             })

+ 14 - 12
src/actions/usersRegistrActions.js

@@ -1,6 +1,6 @@
 import * as types from "../constants/actionTypes";
 
-const axios= require("axios");
+const axios = require("axios");
 
 const userRegRequest = payload => ({
     type: types.USER_REG_REQUEST,
@@ -17,16 +17,18 @@ const userRegRequestFail = payload => ({
     payload
 });
 
-export const postUsersData = (payload) =>{
+export const postUsersData = (payload) => {
     return dispatch => {
-    dispatch(userRegRequest());
-    return axios.post(`http://127.0.0.1:2000/api/users`,payload)
-                    .then(res => {
-                            setTimeout(()=>{dispatch(userRegRequestSuccess(res))},2000);
-                        })
-                    .catch(err=>{
-                            dispatch(userRegRequestFail(err));
-                    })    
-      
-  };
+        dispatch(userRegRequest());
+        return axios.post(`http://127.0.0.1:2000/api/users`, payload)
+            .then(res => {
+                setTimeout(() => {
+                    dispatch(userRegRequestSuccess(res))
+                }, 2000);
+            })
+            .catch(err => {
+                dispatch(userRegRequestFail(err));
+            })
+
+    };
 };

+ 4 - 2
src/components/AllStaffs/FullInfoAboutStaff.js

@@ -18,8 +18,10 @@ class FullInfoAboutStaff extends Component {
              </div> 
             }
             else {
-                data = InfoStaff.map((el,key)=>(<div className="staff"  key={key}> {el.title} {el.price} {el.description} {el.img} </div>)
-                    )
+                data = InfoStaff.map((el,key)=>(
+                <div className="staff" key={key}> {el.title} {el.price} {el.description} {el.img} </div>
+                                                )
+                                    )
             }
         return (
 

+ 6 - 2
src/components/AllStaffs/index.js

@@ -23,9 +23,13 @@ class AllStaffs extends Component {
             }
             else{
                 data = <div className="staffs">
-                    {inputStaffs.map((el,key)=>(<Link to={`/staff/${el.id}`}  key={key}  ><div className="staff" > {el.title} {el.price}  </div></Link> )
+                    {inputStaffs.map((el,key)=>(
+                    <Link to={`/staff/${el.id}`}  key={key}>
+                    <div className="staff"> {el.title} {el.price}</div>
+                    </Link> 
+                                                )
 
-                    )}    
+                                    )}    
                       </div>
             }
         return (

+ 9 - 6
src/components/Header/searchLine.js

@@ -97,12 +97,15 @@ class SearchLine extends Component {
         return (
 
             <div className="header__searchLine">
-            <input onChange={this.changeHandler}  className="searchInput" placeholder="Что будем покупать?"/>
-            <Link to = {`/search/${inputData}`} ><button onClick={this.send} className="searchBtn" > <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32" className="icon">
-    <rect className="fill-none" width="32" height="32"/>
-    <path className="fill-currentcolor" d="M29.82861,24.17139,25.56519,19.908A13.0381,13.0381,0,1,0,19.908,25.56525l4.26343,4.26337a4.00026,4.00026,0,0,0,5.65723-5.65723ZM5,14a9,9,0,1,1,9,9A9.00984,9.00984,0,0,1,5,14Z"/>
-  </svg></button></Link>
-  
+                <input onChange={this.changeHandler}  className="searchInput" placeholder="Что будем покупать?"/>
+                    <Link to = {`/search/${inputData}`} >
+                        <button onClick={this.send} className="searchBtn" > 
+                            <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32" className="icon">
+                                <rect className="fill-none" width="32" height="32"/>
+                                    <path className="fill-currentcolor" d="M29.82861,24.17139,25.56519,19.908A13.0381,13.0381,0,1,0,19.908,25.56525l4.26343,4.26337a4.00026,4.00026,0,0,0,5.65723-5.65723ZM5,14a9,9,0,1,1,9,9A9.00984,9.00984,0,0,1,5,14Z"/>
+                            </svg>
+                        </button>
+                    </Link>
             </div>
 
         );

+ 6 - 2
src/components/SearchStaffsPage/index.js

@@ -20,8 +20,12 @@ class searchStaffs extends Component {
             }
             else{
                 data = <div className="staffs">
-                      {searchData.map((el,key)=>(<Link to = {`/search/Staff/${el.id}`}  key={key}  ><div className="staff" > {el.title} {el.price}  </div></Link> )
-                    )}
+                      {searchData.map((el,key)=>(
+                      <Link to = {`/search/Staff/${el.id}`}  key={key}  >
+                        <div className="staff" > {el.title} {el.price}  </div>
+                      </Link> 
+                                                )
+                                    )}
                       </div>
             }
         return (