Files
dpage-editor/src/pages/home/service/HomeService.ts
T
2026-03-10 12:23:03 +03:30

32 lines
864 B
TypeScript

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