메뉴 배너 관리

This commit is contained in:
2025-04-21 14:14:34 +09:00
parent 1598fa93b6
commit d2ac5b338e
18 changed files with 935 additions and 13 deletions

114
src/apis/Menu.js Normal file
View File

@@ -0,0 +1,114 @@
//운영서비스 관리 - 메뉴배너 api 연결
import { Axios } from '../utils';
// 리스트 조회
export const MenuBannerView = async (token, searchData, status, startDate, endDate, order, size, currentPage) => {
try {
const res = await Axios.get(
`/api/v1/menu/banner/list?search_data=${searchData}&status=${status}&start_dt=${startDate}&end_dt=${endDate}
&orderby=${order}&page_no=${currentPage}&page_size=${size}`,
{
headers: { Authorization: `Bearer ${token}` },
},
);
return res.data.data;
} catch (e) {
if (e instanceof Error) {
throw new Error('MenuBannerView Error', e);
}
}
};
// 상세보기
export const MenuBannerDetailView = async (token, id) => {
try {
const res = await Axios.get(`/api/v1/menu/banner/detail/${id}`, {
headers: { Authorization: `Bearer ${token}` },
});
return res.data.data;
} catch (e) {
if (e instanceof Error) {
throw new Error('MenuBannerDetailView Error', e);
}
}
};
// 등록
export const MenuBannerSingleRegist = async (token, params) => {
try {
const res = await Axios.post(`/api/v1/menu/banner`, params, {
headers: { Authorization: `Bearer ${token}` },
});
return res.data;
} catch (e) {
if (e instanceof Error) {
throw new Error('MenuBannerSingleRegist Error', e);
}
}
};
// 수정
export const MenuBannerModify = async (token, id, params) => {
try {
const res = await Axios.put(`/api/v1/menu/banner/${id}`, params, {
headers: { Authorization: `Bearer ${token}` },
});
return res.data;
} catch (e) {
if (e instanceof Error) {
throw new Error('MenuBannerModify Error', e);
}
}
};
// 삭제
export const MenuBannerDelete = async (token, params) => {
try {
const res = await Axios.delete(`/api/v1/menu/banner/delete`, {
headers: { Authorization: `Bearer ${token}` },
data: { list: params },
});
return res.data;
} catch (e) {
if (e instanceof Error) {
throw new Error('MenuBannerDelete Error', e);
}
}
};
export const MenuImageUpload = async (token, file) => {
const exelFile = new FormData();
exelFile.append('file', file);
try {
const res = await Axios.post(`/api/v1/menu/image-upload`, exelFile, {
headers: {
'Content-Type': 'multipart/form-data',
Authorization: `Bearer ${token}`,
},
});
return res.data;
} catch (e) {
if (e instanceof Error) {
throw new Error('MenuImageUpload', e);
}
}
};
export const MenuImageDelete = async (token, filename) => {
try {
const res = await Axios.get(`/api/v1/menu/image-delete?file=${filename}`, {
headers: {Authorization: `Bearer ${token}`},
});
return res.data;
} catch (e) {
if (e instanceof Error) {
throw new Error('MenuImageDelete', e);
}
}
};

View File

@@ -12,3 +12,5 @@ export * from './Item';
export * from './Event';
export * from './Calium';
export * from './Land';
export * from './Menu';
export * from './OpenAI';