70 lines
1.5 KiB
JavaScript
70 lines
1.5 KiB
JavaScript
//운영 서비스 관리 - 인게임 메세지 api 연결
|
|
|
|
import { Axios } from '../utils';
|
|
|
|
export const NoticeListView = async token => {
|
|
try {
|
|
const res = await Axios.get(`/api/v1/notice/list`, {
|
|
headers: { Authorization: `Bearer ${token}` },
|
|
});
|
|
return res.data.data.list;
|
|
} catch (e) {
|
|
if (e instanceof Error) {
|
|
throw new Error('NoticeList', e);
|
|
}
|
|
}
|
|
};
|
|
|
|
export const NoticeDetailView = async (token, id) => {
|
|
try {
|
|
const res = await Axios.get(`/api/v1/notice/detail/${id}`, {
|
|
headers: { Authorization: `Bearer ${token}` },
|
|
});
|
|
return res.data.data;
|
|
} catch (e) {
|
|
if (e instanceof Error) {
|
|
throw new Error('NoticeDetailView Error', e);
|
|
}
|
|
}
|
|
};
|
|
|
|
export const NoticeRegist = async (token, params) => {
|
|
try {
|
|
const res = await Axios.post('/api/v1/notice', params, {
|
|
headers: { Authorization: `Bearer ${token}` },
|
|
});
|
|
return res;
|
|
} catch (e) {
|
|
if (e instanceof Error) {
|
|
throw new Error('NoticeRegist Error', e);
|
|
}
|
|
}
|
|
};
|
|
|
|
export const NoticeModify = async (token, id, params) => {
|
|
try {
|
|
const res = await Axios.put(`/api/v1/notice/${id}`, params, {
|
|
headers: { Authorization: `Bearer ${token}` },
|
|
});
|
|
return res;
|
|
} catch (e) {
|
|
if (e instanceof Error) {
|
|
throw new Error('NoticeModify Error', e);
|
|
}
|
|
}
|
|
};
|
|
|
|
export const NoticeDelete = async (token, params) => {
|
|
try {
|
|
const res = await Axios.delete('/api/v1/notice', {
|
|
headers: { Authorization: `Bearer ${token}` },
|
|
data: { list: params },
|
|
});
|
|
return res;
|
|
} catch (e) {
|
|
if (e instanceof Error) {
|
|
throw new Error('NoticeDelete Error', e);
|
|
}
|
|
}
|
|
};
|