149 lines
3.5 KiB
JavaScript
149 lines
3.5 KiB
JavaScript
//운영서비스 관리 - 전투시스템 api 연결
|
|
|
|
import { Axios } from '../utils';
|
|
|
|
// 전투시스템 리스트 조회
|
|
export const BattleEventView = async (token, searchType, searchData, configId, rewardId, repeatType, status, roundCount, hotTime, startDate, endDate, order, size, currentPage) => {
|
|
try {
|
|
const res = await Axios.get(
|
|
`/api/v1/battle/event/list?search_type=${searchType}&search_data=${searchData}&config_id=${configId}&reward_id=${rewardId}&repeat_type=${repeatType}&status=${status}&round_count=${roundCount}&hot_time=${hotTime}&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('BattleEventView Error', e);
|
|
}
|
|
}
|
|
};
|
|
|
|
// 전투시스템 상세보기
|
|
export const BattleEventDetailView = async (token, id) => {
|
|
try {
|
|
const res = await Axios.get(`/api/v1/battle/event/detail/${id}`, {
|
|
headers: { Authorization: `Bearer ${token}` },
|
|
});
|
|
|
|
return res.data.data;
|
|
} catch (e) {
|
|
if (e instanceof Error) {
|
|
throw new Error('BattleEventDetailView Error', e);
|
|
}
|
|
}
|
|
};
|
|
|
|
// 전투시스템 등록
|
|
export const BattleEventSingleRegist = async (token, params) => {
|
|
try {
|
|
const res = await Axios.post(`/api/v1/battle/event`, params, {
|
|
headers: { Authorization: `Bearer ${token}` },
|
|
});
|
|
|
|
return res.data;
|
|
} catch (e) {
|
|
if (e instanceof Error) {
|
|
throw new Error('BattleEventSingleRegist Error', e);
|
|
}
|
|
}
|
|
};
|
|
|
|
// 전투시스템 수정
|
|
export const BattleEventModify = async (token, id, params) => {
|
|
try {
|
|
const res = await Axios.put(`/api/v1/battle/event/${id}`, params, {
|
|
headers: { Authorization: `Bearer ${token}` },
|
|
});
|
|
|
|
return res.data;
|
|
} catch (e) {
|
|
if (e instanceof Error) {
|
|
throw new Error('BattleEventModify Error', e);
|
|
}
|
|
}
|
|
};
|
|
|
|
//전투시스템 중단
|
|
export const BattleEventStop = async (token, id, params) => {
|
|
try {
|
|
const res = await Axios.put(`/api/v1/battle/event/stop/${id}`, {},{
|
|
headers: { Authorization: `Bearer ${token}` },
|
|
});
|
|
|
|
return res.data;
|
|
} catch (e) {
|
|
if (e instanceof Error) {
|
|
throw new Error('BattleEventStop Error', e);
|
|
}
|
|
}
|
|
};
|
|
|
|
// 전투시스템 삭제
|
|
export const BattleEventDelete = async (token, params) => {
|
|
try {
|
|
const res = await Axios.delete(`/api/v1/battle/event/delete`, {
|
|
headers: { Authorization: `Bearer ${token}` },
|
|
data: { list: params },
|
|
});
|
|
|
|
return res.data;
|
|
} catch (e) {
|
|
if (e instanceof Error) {
|
|
throw new Error('BattleEventDelete Error', e);
|
|
}
|
|
}
|
|
};
|
|
|
|
export const BattleConfigView = async (token) => {
|
|
try {
|
|
const res = await Axios.get(
|
|
`/api/v1/battle/config/list`,
|
|
{
|
|
headers: { Authorization: `Bearer ${token}` },
|
|
},
|
|
);
|
|
|
|
return res.data.data.battle_config_list;
|
|
} catch (e) {
|
|
if (e instanceof Error) {
|
|
throw new Error('BattleConfigView Error', e);
|
|
}
|
|
}
|
|
};
|
|
|
|
export const BattleRewardView = async (token) => {
|
|
try {
|
|
const res = await Axios.get(
|
|
`/api/v1/battle/reward/list`,
|
|
{
|
|
headers: { Authorization: `Bearer ${token}` },
|
|
},
|
|
);
|
|
|
|
return res.data.data.battle_reward_list;
|
|
} catch (e) {
|
|
if (e instanceof Error) {
|
|
throw new Error('BattleRewardView Error', e);
|
|
}
|
|
}
|
|
};
|
|
|
|
export const GameModeView = async (token) => {
|
|
try {
|
|
const res = await Axios.get(
|
|
`/api/v1/battle/game-mode/list`,
|
|
{
|
|
headers: { Authorization: `Bearer ${token}` },
|
|
},
|
|
);
|
|
|
|
return res.data.data.game_mode_list;
|
|
} catch (e) {
|
|
if (e instanceof Error) {
|
|
throw new Error('GameModeView Error', e);
|
|
}
|
|
}
|
|
}; |