feat(admin): add delete functionality for areas, categories, and teams in admin panel

This commit is contained in:
gabdevele
2026-06-15 17:06:20 +02:00
committed by reloia
Unverified
parent 00b0f97505
commit b38ba74cc0
9 changed files with 538 additions and 45 deletions
+12
View File
@@ -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,
}