|
@@ -38,13 +38,6 @@ export const changeSpecialityArray = payload => ({
|
|
payload
|
|
payload
|
|
});
|
|
});
|
|
|
|
|
|
-// -----------------------------------------------------------------------------------------------------------------
|
|
|
|
-
|
|
|
|
-export const setSheduleDoctor = payload => ({
|
|
|
|
- type: types.CHANGE_SHEDULE_DOCTOR,
|
|
|
|
- payload
|
|
|
|
-});
|
|
|
|
-
|
|
|
|
// -----------------------------------------------------------------------------------------------------------------
|
|
// -----------------------------------------------------------------------------------------------------------------
|
|
// -----------------------------------------------------------------------------------------------------------------
|
|
// -----------------------------------------------------------------------------------------------------------------
|
|
|
|
|
|
@@ -76,34 +69,6 @@ export const getDoctors = () => dispatch => {
|
|
|
|
|
|
// -----------------------------------------------------------------------------------------------------------------
|
|
// -----------------------------------------------------------------------------------------------------------------
|
|
|
|
|
|
-// const getServicesRequest = payload => ({
|
|
|
|
-// type: types.GET_SERVICES_REQUEST,
|
|
|
|
-// payload
|
|
|
|
-// });
|
|
|
|
-//
|
|
|
|
-// const getServicesRequestSuccess = payload => ({
|
|
|
|
-// type: types.GET_SERVICES_REQUEST_SUCCESS,
|
|
|
|
-// payload
|
|
|
|
-// });
|
|
|
|
-//
|
|
|
|
-// const getServicesRequestFail = payload => ({
|
|
|
|
-// type: types.GET_SERVICES_REQUEST_FAIL,
|
|
|
|
-// payload
|
|
|
|
-// });
|
|
|
|
-//
|
|
|
|
-// export const getServices = () => dispatch => {
|
|
|
|
-// dispatch(getServicesRequest());
|
|
|
|
-// return fetch(`${URL}services`,{
|
|
|
|
-// credentials:"include"
|
|
|
|
-// })
|
|
|
|
-// .then(res => res.json())
|
|
|
|
-// .then(res => dispatch(getServicesRequestSuccess(res)))
|
|
|
|
-// .catch(err => dispatch(getServicesRequestFail(err)));
|
|
|
|
-// };
|
|
|
|
-
|
|
|
|
-// -----------------------------------------------------------------------------------------------------------------
|
|
|
|
-// -----------------------------------------------------------------------------------------------------------------
|
|
|
|
-
|
|
|
|
const postDoctorsRequest = payload => ({
|
|
const postDoctorsRequest = payload => ({
|
|
type: types.POST_DOCTORS_REQUEST,
|
|
type: types.POST_DOCTORS_REQUEST,
|
|
payload
|
|
payload
|
|
@@ -130,77 +95,12 @@ export const postDoctors = (payload) => dispatch => {
|
|
body: JSON.stringify(payload)
|
|
body: JSON.stringify(payload)
|
|
})
|
|
})
|
|
.then(res => res.json())
|
|
.then(res => res.json())
|
|
- .then(res => dispatch(postDoctorsRequestSuccess(res)))
|
|
|
|
|
|
+ .then(res => dispatch(postDoctorsRequestSuccess(res))).then(dispatch(getDoctors()))
|
|
.catch(err => dispatch(postDoctorsRequestFail(err)));
|
|
.catch(err => dispatch(postDoctorsRequestFail(err)));
|
|
};
|
|
};
|
|
|
|
|
|
// -----------------------------------------------------------------------------------------------------------------
|
|
// -----------------------------------------------------------------------------------------------------------------
|
|
|
|
|
|
-const postServicesRequest = payload => ({
|
|
|
|
- type: types.POST_SERVICES_REQUEST,
|
|
|
|
- payload
|
|
|
|
-});
|
|
|
|
-
|
|
|
|
-const postServicesRequestSuccess = payload => ({
|
|
|
|
- type: types.POST_SERVICES_REQUEST_SUCCESS,
|
|
|
|
- payload
|
|
|
|
-});
|
|
|
|
-
|
|
|
|
-const postServicesRequestFail = payload => ({
|
|
|
|
- type: types.POST_SERVICES_REQUEST_FAIL,
|
|
|
|
- payload
|
|
|
|
-});
|
|
|
|
-
|
|
|
|
-export const postServices = (payload) => dispatch => {
|
|
|
|
- dispatch(postServicesRequest());
|
|
|
|
- return fetch(`${URL}services`, {
|
|
|
|
- method: "POST",
|
|
|
|
- credentials: "include",
|
|
|
|
- headers: {
|
|
|
|
- "Content-Type": "application/json"
|
|
|
|
- },
|
|
|
|
- body: JSON.stringify(payload)
|
|
|
|
- })
|
|
|
|
- .then(res => res.json())
|
|
|
|
- .then(res => dispatch(postServicesRequestSuccess(res)))
|
|
|
|
- .catch(err => dispatch(postServicesRequestFail(err)))
|
|
|
|
-};
|
|
|
|
-
|
|
|
|
-// -----------------------------------------------------------------------------------------------------------------
|
|
|
|
-
|
|
|
|
-const postSheduleRequest = payload => ({
|
|
|
|
- type: types.POST_SHEDULE_REQUEST,
|
|
|
|
- payload
|
|
|
|
-});
|
|
|
|
-
|
|
|
|
-const postSheduleSuccess = payload => ({
|
|
|
|
- type: types.POST_SHEDULE_REQUEST_SUCCESS,
|
|
|
|
- payload
|
|
|
|
-});
|
|
|
|
-
|
|
|
|
-const postSheduleFail = payload => ({
|
|
|
|
- type: types.POST_SHEDULE_REQUEST_FAIL,
|
|
|
|
- payload
|
|
|
|
-});
|
|
|
|
-
|
|
|
|
-export const postShedule = (payload) => dispatch => {
|
|
|
|
- dispatch(postSheduleRequest());
|
|
|
|
- return fetch(`${URL}shedule`, {
|
|
|
|
- method: "POST",
|
|
|
|
- credentials:"include",
|
|
|
|
- headers: {
|
|
|
|
- 'Content-Type': 'application/json'
|
|
|
|
- },
|
|
|
|
- body: JSON.stringify(payload)
|
|
|
|
- })
|
|
|
|
- .then(res => res.json())
|
|
|
|
- .then(res => dispatch(postSheduleSuccess(res))).then(dispatch(getDoctors()))
|
|
|
|
- .catch(err => dispatch(postSheduleFail(err)));
|
|
|
|
-};
|
|
|
|
-
|
|
|
|
-// -----------------------------------------------------------------------------------------------------------------
|
|
|
|
-// -----------------------------------------------------------------------------------------------------------------
|
|
|
|
-
|
|
|
|
const putDoctorsRequest = payload => ({
|
|
const putDoctorsRequest = payload => ({
|
|
type: types.PUT_DOCTORS_REQUEST,
|
|
type: types.PUT_DOCTORS_REQUEST,
|
|
payload
|
|
payload
|
|
@@ -227,73 +127,12 @@ export const putDoctors = (payload) => dispatch => {
|
|
body: JSON.stringify(payload.data)
|
|
body: JSON.stringify(payload.data)
|
|
})
|
|
})
|
|
.then(res => res.json())
|
|
.then(res => res.json())
|
|
- .then(res => dispatch(putDoctorsRequestSuccess(res)))
|
|
|
|
|
|
+ .then(res => dispatch(putDoctorsRequestSuccess(res))).then(dispatch(getDoctors()))
|
|
.catch(err => dispatch(putDoctorsRequestFail(err)));
|
|
.catch(err => dispatch(putDoctorsRequestFail(err)));
|
|
};
|
|
};
|
|
|
|
|
|
// -----------------------------------------------------------------------------------------------------------------
|
|
// -----------------------------------------------------------------------------------------------------------------
|
|
|
|
|
|
-const putServicesRequest = payload => ({
|
|
|
|
- type: types.PUT_SERVICES_REQUEST,
|
|
|
|
- payload
|
|
|
|
-});
|
|
|
|
-
|
|
|
|
-const putServicesRequestSuccess = payload => ({
|
|
|
|
- type: types.PUT_SERVICES_REQUEST_SUCCESS,
|
|
|
|
- payload
|
|
|
|
-});
|
|
|
|
-
|
|
|
|
-const putServicesRequestFail = payload => ({
|
|
|
|
- type: types.PUT_SERVICES_REQUEST_FAIL,
|
|
|
|
- payload
|
|
|
|
-});
|
|
|
|
-
|
|
|
|
-export const putServices = (payload) => dispatch => {
|
|
|
|
- dispatch(putServicesRequest());
|
|
|
|
- return fetch(`${URL}services/${payload.id}`, {
|
|
|
|
- method: "PUT",
|
|
|
|
- credentials: "include",
|
|
|
|
- headers: {
|
|
|
|
- "Content-Type": "application/json"
|
|
|
|
- },
|
|
|
|
- body: JSON.stringify(payload.data)
|
|
|
|
- })
|
|
|
|
- .then(res => res.json())
|
|
|
|
- .then(res => dispatch(putServicesRequestSuccess(res)))
|
|
|
|
- .catch(err => dispatch(putServicesRequestFail(err)));
|
|
|
|
-};
|
|
|
|
-
|
|
|
|
-// -----------------------------------------------------------------------------------------------------------------
|
|
|
|
-// -----------------------------------------------------------------------------------------------------------------
|
|
|
|
-
|
|
|
|
-const deleteServicesRequest = payload => ({
|
|
|
|
- type: types.DELETE_DOCTORS_REQUEST,
|
|
|
|
- payload
|
|
|
|
-});
|
|
|
|
-
|
|
|
|
-const deleteServicesRequestSuccess = payload => ({
|
|
|
|
- type: types.DELETE_DOCTORS_REQUEST_SUCCESS,
|
|
|
|
- payload
|
|
|
|
-});
|
|
|
|
-
|
|
|
|
-const deleteServicesRequestFail = payload => ({
|
|
|
|
- type: types.DELETE_DOCTORS_REQUEST_FAIL,
|
|
|
|
- payload
|
|
|
|
-});
|
|
|
|
-
|
|
|
|
-export const deleteServices = (payload) => dispatch => {
|
|
|
|
- dispatch(deleteServicesRequest());
|
|
|
|
- return fetch(`${URL}services/${payload}`, {
|
|
|
|
- method: "DELETE",
|
|
|
|
- credentials: "include"
|
|
|
|
- })
|
|
|
|
- .then(res => res.json())
|
|
|
|
- .then(res => dispatch(deleteServicesRequestSuccess(res)))
|
|
|
|
- .catch(err => dispatch(deleteServicesRequestFail(err)));
|
|
|
|
-};
|
|
|
|
-
|
|
|
|
-// -----------------------------------------------------------------------------------------------------------------
|
|
|
|
-
|
|
|
|
const deleteDoctorsRequest = payload => ({
|
|
const deleteDoctorsRequest = payload => ({
|
|
type: types.DELETE_DOCTORS_REQUEST,
|
|
type: types.DELETE_DOCTORS_REQUEST,
|
|
payload
|
|
payload
|
|
@@ -316,7 +155,7 @@ export const deleteDoctors = (payload) => dispatch => {
|
|
credentials: "include"
|
|
credentials: "include"
|
|
})
|
|
})
|
|
.then(res => res.json())
|
|
.then(res => res.json())
|
|
- .then(res => dispatch(deleteDoctorsRequestSuccess(res)))
|
|
|
|
|
|
+ .then(res => dispatch(deleteDoctorsRequestSuccess(res))).then(dispatch(getDoctors()))
|
|
.catch(err => dispatch(deleteDoctorsRequestFail(err)));
|
|
.catch(err => dispatch(deleteDoctorsRequestFail(err)));
|
|
};
|
|
};
|
|
|
|
|