diff --git a/src/constants/request.ts b/src/constants/request.ts index 8995f5e35..d10a129bf 100644 --- a/src/constants/request.ts +++ b/src/constants/request.ts @@ -57,7 +57,8 @@ export const URLs = { delete: '/attachments' }, questions: { - get: '/questions' + get: '/questions', + delete: '/questions' } }, messages: { diff --git a/src/containers/my-resources/questions-container/QuestionsContainer.tsx b/src/containers/my-resources/questions-container/QuestionsContainer.tsx index 7528543fe..5b6e98115 100644 --- a/src/containers/my-resources/questions-container/QuestionsContainer.tsx +++ b/src/containers/my-resources/questions-container/QuestionsContainer.tsx @@ -73,10 +73,15 @@ const QuestionsContainer = () => { onResponseError }) + const deleteQuestion = useCallback( + (id?: string) => ResourceService.deleteQuestion(id ?? ''), + [] + ) + const props = { columns: columnsToShow, data: { response, getData: fetchData }, - services: { deleteService: () => null }, + services: { deleteService: deleteQuestion }, itemsPerPage, actions: { onEdit: () => null }, resource: ResourcesTabsEnum.Questions, diff --git a/src/services/resource-service.ts b/src/services/resource-service.ts index 21eb78037..46d4591a4 100644 --- a/src/services/resource-service.ts +++ b/src/services/resource-service.ts @@ -53,5 +53,7 @@ export const ResourceService = { params?: GetResourcesParams ): Promise>> => { return axiosClient.get(URLs.resources.questions.get, { params }) - } + }, + deleteQuestion: async (id: string): Promise => + await axiosClient.delete(createUrlPath(URLs.resources.questions.delete, id)) }