load and save pages

This commit is contained in:
hamid zarghami
2026-03-10 12:23:03 +03:30
parent c9eccecb61
commit 36a1caba0f
5 changed files with 95 additions and 4 deletions
+16 -3
View File
@@ -1,6 +1,12 @@
import axios from "@/config/axios";
import type { CreateCatalogParamsType } from "../types/Types";
import type { CatalogResponseType } from "@/pages/catalogue/types/Types";
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);
@@ -13,6 +19,13 @@ export const getCatalogs = async () => {
};
export const getCatalogById = async (id: string) => {
const { data } = await axios.get(`/catalogue/${id}`);
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;
};