Skip to content

Commit 9e5651c

Browse files
committed
Fix Task Edit Error
1 parent 51ef3e5 commit 9e5651c

1 file changed

Lines changed: 24 additions & 11 deletions

File tree

src/frontend/src/apis/tasks.api.ts

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import { Task, TaskPriority, TaskStatus, WbsNumber, wbsPipe } from 'shared';
77
import axios from '../utils/axios';
88
import { apiUrls } from '../utils/urls';
9+
import { taskTransformer } from './transformers/tasks.transformers';
910

1011
/**
1112
* Api call to create a task.
@@ -26,14 +27,20 @@ export const createSingleTask = (
2627
assignees: string[],
2728
notes: string
2829
) => {
29-
return axios.post<Task>(apiUrls.tasksCreate(wbsPipe(wbsNum)), {
30-
title,
31-
deadline,
32-
priority,
33-
status,
34-
assignees,
35-
notes
36-
});
30+
return axios.post<Task>(
31+
apiUrls.tasksCreate(wbsPipe(wbsNum)),
32+
{
33+
title,
34+
deadline,
35+
priority,
36+
status,
37+
assignees,
38+
notes
39+
},
40+
{
41+
transformResponse: (data) => taskTransformer(JSON.parse(data))
42+
}
43+
);
3744
};
3845

3946
/**
@@ -62,9 +69,15 @@ export const editTask = (taskId: string, title: string, notes: string, priority:
6269
* @returns the edited task
6370
*/
6471
export const editTaskAssignees = (taskId: string, assignees: string[]) => {
65-
return axios.post<Task>(apiUrls.editTaskAssignees(taskId), {
66-
assignees
67-
});
72+
return axios.post<Task>(
73+
apiUrls.editTaskAssignees(taskId),
74+
{
75+
assignees
76+
},
77+
{
78+
transformResponse: (data) => taskTransformer(JSON.parse(data))
79+
}
80+
);
6881
};
6982

7083
/**

0 commit comments

Comments
 (0)