This commit is contained in:
2026-06-13 12:23:07 +03:30
parent a14f1587c6
commit 164dbbfe53
14 changed files with 376 additions and 127 deletions
+22
View File
@@ -0,0 +1,22 @@
import useAxios from '@core/utils/useAxios'
import type { Category, CategoryInput } from '@/model/category'
export type CategoryListParams = {
active?: number
select_only?: boolean
search?: string
}
export const getCategories = async (params?: CategoryListParams) =>
await useAxios.get<Category[]>('/admin/categories', { params })
export const updateCategory = async (id: number, payload: Partial<CategoryInput>) =>
await useAxios.put<Category>(`/admin/categories/${id}`, payload)
export const syncCategoriesFromProducts = async () =>
await useAxios.post<{ message: string; created: number; items: Category[] }>(
'/admin/categories/sync-from-products'
)
export const changeCategoryActive = async (id: number, active: 0 | 1) =>
await useAxios.get(`/admin/categories/${id}/active/${active}`)