Files
dpage-editor/src/pages/home/service/HomeService.ts
T
hamid zarghami 04da87b7d7
deploy to danak / build_and_deploy (push) Has been cancelled
fix update
2026-06-01 14:09:51 +03:30

46 lines
1.2 KiB
TypeScript

import axios from "@/config/axios";
import type {
CatalogByIdResponseType,
CatalogResponseType,
} from "@/pages/catalogue/types/Types";
import type {
CreateCatalogParamsType,
UpdateCatalogParamsType,
} from "../types/Types";
export const createCatalog = async (params: CreateCatalogParamsType) => {
const { data } = await axios.post("/admin/catalogue", params);
return data;
};
export const getCatalogs = async () => {
const { data } = await axios.get<CatalogResponseType>("/admin/catalogue");
return data;
};
export const getCatalogById = async (id: string) => {
const { data } = await axios.get<CatalogByIdResponseType>(
`/admin/catalogue/${id}`,
);
return data;
};
export const getCatalogBySlug = async (slug: string) => {
const { data } = await axios.get<CatalogByIdResponseType>(
`/public/catalogue/slug/${slug}`,
);
return data;
};
export const updateCatalog = async (params: UpdateCatalogParamsType) => {
const { data } = await axios.patch(`/admin/catalogue/${params.id}`, {
content: params.content,
});
return data;
};
export const deleteCatalogById = async (id: string) => {
const { data } = await axios.delete(`/admin/catalogue/${id}`);
return data;
};