#110 added raw action fetch all tasks by member

parent 168d7e7c
......@@ -24,4 +24,8 @@ export const EDIT_CALENDAR_TASK = "EDIT_CALENDAR_TASK";
export const DELETE_DATETIMETASK_REQUEST = "DELETE_TASK_REQUEST";
export const DELETE_DATETIMETASK_SUCCESS = "DELETE_TASK_SUCCESS";
export const DELETE_DATETIMETASK_FAILURE = "DELETE_TASK_FAILURE";
\ No newline at end of file
export const DELETE_DATETIMETASK_FAILURE = "DELETE_TASK_FAILURE";
export const FETCH_ALL_TASKS_BY_MEMBERSHIP_REQUEST = "FETCH_ALL_TASKS_BY_MEMBERSHIP_REQUEST";
export const FETCH_ALL_TASKS_BY_MEMBERSHIP_SUCCESS = "FETCH_ALL_TASKS_BY_MEMBERSHIP_SUCCESS";
export const FETCH_ALL_TASKS_BY_MEMBERSHIP_FAILURE = "FETCH_ALL_TASKS_BY_MEMBERSHIP_FAILURE";
\ No newline at end of file
......@@ -61,8 +61,36 @@ export const fetchAllTasks = () => {
}
}
};
//**fetch tasks for table UsersTasks, start*/
const fetchAllTasksByMembershipSuccess = (tasks) => {
return {type: FETCH_ALL_TASKS_SUCCESS, tasks}
};
const fetchUsersTasksFailure = (error) => {
return {type: FETCH_CALENDAR_TASKS_FAILURE, error}
};
export const fetcAllTasksByMembership = () => {
return async (dispatch) => {
dispatch(fetchCalendarTasksRequest());
try {
const response = await axios.get("/tasks/users-tasks");
dispatch(fetchAllTasksByMembershipSuccess(response.data.tasks))
} catch (error) {
dispatch(fetchCalendarTasksFailure(error.response.data));
}
}
};
//**end*/
const addTaskRequest = () => {
return {type: ADD_NEW_TASK_REQUEST}
return {type: ADD_NEW_TASK_REQUEST}
};
const addTaskSuccess = () => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment