diff --git a/app/composables/useAdmin.ts b/app/composables/useAdmin.ts index faf12a8..9393081 100644 --- a/app/composables/useAdmin.ts +++ b/app/composables/useAdmin.ts @@ -3,6 +3,7 @@ import type { ModerationListResponse, OkResponse, OverviewStatsResponse, TeamListResponse, UpdateModerationRequest, + UpdateAreaRequest, UpdateCategoryRequest, UpdateTeamRequest, UpdateUserBanRequest, UpdateUserRolesRequest, UserListResponse } from "~/types/api"; @@ -26,17 +27,26 @@ export const useAdmin = () => { const createArea = (body: CreateAreaRequest) => useApiFetch('/api/v1/admin/areas', { method: 'POST', body }) + const updateArea = (id: number, body: UpdateAreaRequest) => + useApiFetch(`/api/v1/admin/areas/${id}`, { method: 'PATCH', body }) + const getCategories = () => useApiFetch('/api/v1/admin/categories', { method: 'GET' }) const createCategory = (body: CreateCategoryRequest) => useApiFetch('/api/v1/admin/categories', { method: 'POST', body }) + const updateCategory = (id: number, body: UpdateCategoryRequest) => + useApiFetch(`/api/v1/admin/categories/${id}`, { method: 'PATCH', body }) + const getTeams = () => useApiFetch('/api/v1/admin/teams', { method: 'GET' }) const createTeam = (body: CreateTeamRequest) => useApiFetch('/api/v1/admin/teams', { method: 'POST', body }) + + const updateTeam = (id: number, body: UpdateTeamRequest) => + useApiFetch(`/api/v1/admin/teams/${id}`, { method: 'PATCH', body }) const getModerationFlags = (query?: { status?: string; page?: number; per_page?: number }) => useApiFetch('/api/v1/admin/moderation', { method: 'GET', query }) @@ -51,10 +61,13 @@ export const useAdmin = () => { updateUserRoles, getAreas, createArea, + updateArea, getCategories, createCategory, + updateCategory, getTeams, createTeam, + updateTeam, getModerationFlags, updateModerationFlag, } diff --git a/app/pages/admin/areas.vue b/app/pages/admin/areas.vue index 6b49fcf..cb44580 100644 --- a/app/pages/admin/areas.vue +++ b/app/pages/admin/areas.vue @@ -1,5 +1,5 @@ @@ -178,6 +268,7 @@ const handleCreate = async () => { Descrizione Stato GeoJSON + Azioni @@ -193,6 +284,18 @@ const handleCreate = async () => { Configurato Mancante + + + + @@ -204,7 +307,7 @@ const handleCreate = async () => {