Skip to content

Commit

Permalink
Implemented delete for question (#1132)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yurenko authored Sep 22, 2023
1 parent e3cad40 commit fe56b22
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/constants/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ export const URLs = {
delete: '/attachments'
},
questions: {
get: '/questions'
get: '/questions',
delete: '/questions'
}
},
messages: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 3 additions & 1 deletion src/services/resource-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,7 @@ export const ResourceService = {
params?: GetResourcesParams
): Promise<AxiosResponse<ItemsWithCount<Question>>> => {
return axiosClient.get(URLs.resources.questions.get, { params })
}
},
deleteQuestion: async (id: string): Promise<AxiosResponse> =>
await axiosClient.delete(createUrlPath(URLs.resources.questions.delete, id))
}

0 comments on commit fe56b22

Please sign in to comment.