update section

This commit is contained in:
hamid zarghami
2026-02-02 10:03:24 +03:30
parent a25ab81d08
commit 7f2000ec6d
7 changed files with 154 additions and 3 deletions
+17 -1
View File
@@ -1,5 +1,9 @@
import axios from "@/config/axios";
import type { CreateSectionType, SectionsResponseType } from "../types/Types";
import type {
CreateSectionType,
SectionDetailResponseType,
SectionsResponseType,
} from "../types/Types";
export const getSections = async () => {
const { data } = await axios.get<SectionsResponseType>(`/admin/section`);
@@ -10,3 +14,15 @@ export const createSection = async (params: CreateSectionType) => {
const { data } = await axios.post(`/admin/section`, params);
return data;
};
export const updateSection = async (id: number, params: CreateSectionType) => {
const { data } = await axios.patch(`/admin/section/${id}`, params);
return data;
};
export const getSectionDetail = async (id: number) => {
const { data } = await axios.get<SectionDetailResponseType>(
`/admin/section/${id}`
);
return data;
};