feat(admin): add delete functionality for areas, categories, and teams in admin panel
This commit is contained in:
@@ -30,6 +30,9 @@ export const useAdmin = () => {
|
||||
const updateArea = (id: number, body: UpdateAreaRequest) =>
|
||||
useApiFetch<OkResponse>(`/api/v1/admin/areas/${id}`, { method: 'PATCH', body })
|
||||
|
||||
const deleteArea = (id: number) =>
|
||||
useApiFetch<OkResponse>(`/api/v1/admin/areas/${id}`, { method: 'DELETE' })
|
||||
|
||||
const getCategories = () =>
|
||||
useApiFetch<CategoryListResponse>('/api/v1/admin/categories', { method: 'GET' })
|
||||
|
||||
@@ -39,6 +42,9 @@ export const useAdmin = () => {
|
||||
const updateCategory = (id: number, body: UpdateCategoryRequest) =>
|
||||
useApiFetch<OkResponse>(`/api/v1/admin/categories/${id}`, { method: 'PATCH', body })
|
||||
|
||||
const deleteCategory = (id: number) =>
|
||||
useApiFetch<OkResponse>(`/api/v1/admin/categories/${id}`, { method: 'DELETE' })
|
||||
|
||||
const getTeams = () =>
|
||||
useApiFetch<TeamListResponse>('/api/v1/admin/teams', { method: 'GET' })
|
||||
|
||||
@@ -47,6 +53,9 @@ export const useAdmin = () => {
|
||||
|
||||
const updateTeam = (id: number, body: UpdateTeamRequest) =>
|
||||
useApiFetch<OkResponse>(`/api/v1/admin/teams/${id}`, { method: 'PATCH', body })
|
||||
|
||||
const deleteTeam = (id: number) =>
|
||||
useApiFetch<OkResponse>(`/api/v1/admin/teams/${id}`, { method: 'DELETE' })
|
||||
|
||||
const getModerationFlags = (query?: { status?: string; page?: number; per_page?: number }) =>
|
||||
useApiFetch<ModerationListResponse>('/api/v1/admin/moderation', { method: 'GET', query })
|
||||
@@ -62,12 +71,15 @@ export const useAdmin = () => {
|
||||
getAreas,
|
||||
createArea,
|
||||
updateArea,
|
||||
deleteArea,
|
||||
getCategories,
|
||||
createCategory,
|
||||
updateCategory,
|
||||
deleteCategory,
|
||||
getTeams,
|
||||
createTeam,
|
||||
updateTeam,
|
||||
deleteTeam,
|
||||
getModerationFlags,
|
||||
updateModerationFlag,
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import type {
|
||||
AssignmentLinkResponse,
|
||||
AssignTeamRequest,
|
||||
InterventionSummaryResponse,
|
||||
OkResponse,
|
||||
@@ -32,6 +33,12 @@ export const useOperator = () => {
|
||||
const getInterventionSummary = (id: number) =>
|
||||
useApiFetch<InterventionSummaryResponse>(`/api/v1/reports/${id}/intervention-summary`, { method: 'GET' })
|
||||
|
||||
const createInterventionLink = (id: number) =>
|
||||
useApiFetch<AssignmentLinkResponse>(`/api/v1/reports/${id}/intervention-link`, { method: 'POST' })
|
||||
|
||||
const revokeInterventionLink = (id: number) =>
|
||||
useApiFetch<OkResponse>(`/api/v1/reports/${id}/intervention-link`, { method: 'DELETE' })
|
||||
|
||||
return {
|
||||
getOpenReports,
|
||||
getAssignedReports,
|
||||
@@ -41,5 +48,7 @@ export const useOperator = () => {
|
||||
updateReportStatus,
|
||||
assignTeam,
|
||||
getInterventionSummary,
|
||||
createInterventionLink,
|
||||
revokeInterventionLink,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user