Commit f09c5cc1 authored by Ermolaev Timur's avatar Ermolaev Timur

#91 Засунул дедлайн, подправил запросы

parent 1f23241a
...@@ -158,18 +158,17 @@ function MonthCalendar() { ...@@ -158,18 +158,17 @@ function MonthCalendar() {
...currentTask, ...currentTask,
dateTimeStart: start, dateTimeStart: start,
dateTimeDue: due, dateTimeDue: due,
dateTimeTaskId: currentTask.id,
taskId: currentTask.mainTaskId taskId: currentTask.mainTaskId
} }
delete newTask.infoForCell delete newTask.infoForCell
delete newTask.id await dispatch(editCalendarTask(newTask, currentTask.id))
await dispatch(editCalendarTask(newTask))
} else { } else {
const newTask = { const newTask = {
...currentTask, ...currentTask,
dateTimeStart: start, dateTimeStart: start,
dateTimeDue: due, dateTimeDue: due,
executor: user, executor: user,
dateTimeDeadLine: due,
} }
delete newTask.infoForCell delete newTask.infoForCell
delete newTask.id delete newTask.id
......
...@@ -77,7 +77,7 @@ export const addCalendarTask = (task) => { ...@@ -77,7 +77,7 @@ export const addCalendarTask = (task) => {
return async (dispatch) => { return async (dispatch) => {
dispatch(addTaskRequest()); dispatch(addTaskRequest());
try { try {
const response = await axios.post("/tasks", task); await axios.post("/tasks", task);
dispatch(addTaskSuccess()) dispatch(addTaskSuccess())
dispatch(fetchCalendarTasks()) dispatch(fetchCalendarTasks())
} catch (error) { } catch (error) {
...@@ -90,7 +90,7 @@ export const addCopyCalendarTask = (task) => { ...@@ -90,7 +90,7 @@ export const addCopyCalendarTask = (task) => {
return async (dispatch) => { return async (dispatch) => {
dispatch(addTaskRequest()); dispatch(addTaskRequest());
try { try {
const response = await axios.post("/copy-tasks/make-copy", task); await axios.post("/copy-tasks/make-copy", task);
dispatch(addTaskSuccess()) dispatch(addTaskSuccess())
dispatch(fetchCalendarTasks()) dispatch(fetchCalendarTasks())
} catch (error) { } catch (error) {
...@@ -137,11 +137,11 @@ export const editTask = (task) => { ...@@ -137,11 +137,11 @@ export const editTask = (task) => {
} }
} }
export const editCalendarTask = (task) => { export const editCalendarTask = (task, taskId) => {
return async (dispatch) => { return async (dispatch) => {
dispatch(editTaskRequest()); dispatch(editTaskRequest());
try { try {
await axios.put("/copy-tasks/change-copy", task); await axios.put(`/copy-tasks/change-copy/${taskId}`, task);
dispatch(editTaskSuccess()) dispatch(editTaskSuccess())
dispatch(fetchCalendarTasks()) dispatch(fetchCalendarTasks())
} catch (error) { } catch (error) {
......
...@@ -12,7 +12,6 @@ import { ...@@ -12,7 +12,6 @@ import {
DELETE_TASK_REQUEST, DELETE_TASK_REQUEST,
DELETE_TASK_FAILURE, DELETE_TASK_FAILURE,
FETCH_ALL_TASKS_SUCCESS, FETCH_ALL_TASKS_SUCCESS,
EDIT_CALENDAR_TASK,
FETCH_TASKS_BY_PROJECT_REQUEST, FETCH_TASKS_BY_PROJECT_REQUEST,
FETCH_TASKS_BY_PROJECT_SUCCESS, FETCH_TASKS_BY_PROJECT_SUCCESS,
FETCH_TASKS_BY_PROJECT_FAILURE, FETCH_TASKS_BY_PROJECT_FAILURE,
......
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