47 lines
1.1 KiB
TypeScript
47 lines
1.1 KiB
TypeScript
import axios from "@/config/axios";
|
|
import type {
|
|
CreatePrintFormType,
|
|
CreateSectionType,
|
|
SectionDetailResponseType,
|
|
SectionsResponseType,
|
|
} from "../types/Types";
|
|
|
|
export const getSections = async () => {
|
|
const { data } = await axios.get<SectionsResponseType>(`/admin/section`);
|
|
return data;
|
|
};
|
|
|
|
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;
|
|
};
|
|
|
|
export const deleteSection = async (id: number) => {
|
|
const { data } = await axios.delete(`/admin/section/${id}`);
|
|
return data;
|
|
};
|
|
|
|
export const createPrintForm = async (
|
|
orderId: string,
|
|
itemId: number,
|
|
params: CreatePrintFormType
|
|
) => {
|
|
const { data } = await axios.patch(
|
|
`/admin/orders/${orderId}/item/${itemId}/print`,
|
|
params
|
|
);
|
|
return data;
|
|
};
|