export const endWorkingDay = () => (dispatch, getState) => {
return axios.post(`${API_ROOT}/api/Account/EndWork?date=${endDate}&tradePointId=${id}&lat=${currentLat}&long=${currentLong}`,
null,
{
headers: {
Authorization: `Bearer ${token}`,
"Content-Type": "application/json;charset=UTF-8",
},
}
)
.then(
response => {
if (response.status === 200) {
dispatch({
type: SET_END_WORK_DATA,
payload: {
endWorkData: {
tradePointId: id,
lat: currentLat,
long: currentLong,
date: dateformat(new Date(), "yyyy-mm-dd"),
synced: true,
},
},
})
Делаем запрос а затем используем диспатч для передачи данных в стор.