132 lines
4.1 KiB
JavaScript
132 lines
4.1 KiB
JavaScript
//운영 정보 관리 - 백과사전 api 연결
|
|
|
|
import { Axios, responseFileDownload } from '../utils';
|
|
|
|
// 아이템 백과사전 조회
|
|
export const getItemDictionaryList = async (token, searchType, searchData, largeType, smallType, brand, gender, order, size, currentPage) => {
|
|
try {
|
|
const response = await Axios.get(`/api/v1/dictionary/item/list?search_type=${searchType}&search_data=${searchData}
|
|
&large_type=${largeType}&small_type=${smallType}&brand=${brand}&gender=${gender}
|
|
&orderby=${order}&page_no=${currentPage}&page_size=${size}`, {
|
|
headers: {
|
|
Authorization: `Bearer ${token}`,
|
|
'Content-Type': 'application/json',
|
|
},
|
|
});
|
|
|
|
return response.data;
|
|
} catch (error) {
|
|
console.error('getItemDictionaryList API error:', error);
|
|
throw error;
|
|
}
|
|
};
|
|
|
|
export const ItemDictionaryExport = async (token, params) => {
|
|
try {
|
|
await Axios.get(`/api/v1/dictionary/item/excel-export?search_type=${params.search_type}&search_data=${params.search_data}
|
|
&large_type=${params.large_type}&small_type=${params.small_type}&brand=${params.brand}&gender=${params.gender}
|
|
&lang=${params.lang}&task_id=${params.taskId}`, {
|
|
headers: { Authorization: `Bearer ${token}` },
|
|
responseType: 'blob'
|
|
}).then(response => {
|
|
responseFileDownload(response, {
|
|
defaultFileName: 'itemDictionary'
|
|
});
|
|
});
|
|
} catch (e) {
|
|
if (e instanceof Error) {
|
|
throw new Error('ItemDictionaryExport Error', e);
|
|
}
|
|
}
|
|
};
|
|
|
|
export const getCraftingDictionaryList = async (token, searchType, searchData, smallType, recipeType, order, size, currentPage) => {
|
|
try {
|
|
const response = await Axios.get(`/api/v1/dictionary/craft/list?search_type=${searchType}&search_data=${searchData}
|
|
&small_type=${smallType}&recipe_type=${recipeType}
|
|
&orderby=${order}&page_no=${currentPage}&page_size=${size}`, {
|
|
headers: {
|
|
Authorization: `Bearer ${token}`,
|
|
'Content-Type': 'application/json',
|
|
},
|
|
});
|
|
|
|
return response.data;
|
|
} catch (error) {
|
|
console.error('getCraftingDictionaryList API error:', error);
|
|
throw error;
|
|
}
|
|
};
|
|
|
|
export const CraftingDictionaryExport = async (token, params) => {
|
|
try {
|
|
await Axios.get(`/api/v1/dictionary/craft/excel-export?search_type=${params.search_type}&search_data=${params.search_data}
|
|
&small_type=${params.small_type}&recipe_type=${params.recipe_type}
|
|
&lang=${params.lang}&task_id=${params.taskId}`, {
|
|
headers: { Authorization: `Bearer ${token}` },
|
|
responseType: 'blob'
|
|
}).then(response => {
|
|
responseFileDownload(response, {
|
|
defaultFileName: 'craftingDictionary'
|
|
});
|
|
});
|
|
} catch (e) {
|
|
if (e instanceof Error) {
|
|
throw new Error('CraftingDictionaryExport Error', e);
|
|
}
|
|
}
|
|
};
|
|
|
|
export const getInstanceDictionaryList = async (token, searchType, searchData, contentsType, accessType, order, size, currentPage) => {
|
|
try {
|
|
const response = await Axios.get(`/api/v1/dictionary/instance/list?search_type=${searchType}&search_data=${searchData}
|
|
&contents_type=${contentsType}&access_type=${accessType}
|
|
&orderby=${order}&page_no=${currentPage}&page_size=${size}`, {
|
|
headers: {
|
|
Authorization: `Bearer ${token}`,
|
|
'Content-Type': 'application/json',
|
|
},
|
|
});
|
|
|
|
return response.data;
|
|
} catch (error) {
|
|
console.error('getInstanceDictionaryList API error:', error);
|
|
throw error;
|
|
}
|
|
};
|
|
|
|
export const InstanceDictionaryExport = async (token, params) => {
|
|
try {
|
|
await Axios.get(`/api/v1/dictionary/instance/excel-export?search_type=${params.search_type}&search_data=${params.search_data}
|
|
&contents_type=${params.contents_type}&access_type=${params.access_type}
|
|
&lang=${params.lang}&task_id=${params.taskId}`, {
|
|
headers: { Authorization: `Bearer ${token}` },
|
|
responseType: 'blob'
|
|
}).then(response => {
|
|
responseFileDownload(response, {
|
|
defaultFileName: 'instanceDictionary'
|
|
});
|
|
});
|
|
} catch (e) {
|
|
if (e instanceof Error) {
|
|
throw new Error('InstanceDictionaryExport Error', e);
|
|
}
|
|
}
|
|
};
|
|
|
|
export const BrandView = async (token) => {
|
|
try {
|
|
const res = await Axios.get(
|
|
`/api/v1/dictionary/brand/list`,
|
|
{
|
|
headers: { Authorization: `Bearer ${token}` },
|
|
},
|
|
);
|
|
|
|
return res.data.data.brand_list;
|
|
} catch (e) {
|
|
if (e instanceof Error) {
|
|
throw new Error('BrandView Error', e);
|
|
}
|
|
}
|
|
}; |