yearCategory, cateList 추가
This commit is contained in:
parent
62047cbf80
commit
d47e3f0d6d
@ -12,27 +12,28 @@ const commonApi = () => {
|
||||
const colorList = ref([]);
|
||||
const mbtiList = ref([]);
|
||||
const pwhintList = ref([]);
|
||||
const yearCategory = ref([]);
|
||||
const cateList = ref([]);
|
||||
|
||||
const CommonCode = async (path, endpoint, targetList) => {
|
||||
|
||||
const response = await $api.get(`${path}/${endpoint}`);
|
||||
targetList.value = response.data.data.map(item => ({
|
||||
label: item.CMNCODNAM,
|
||||
value: item.CMNCODVAL,
|
||||
}));
|
||||
|
||||
const CommonCode = async (endpoint, targetList) => {
|
||||
try {
|
||||
const response = await $api.get(`/user/${endpoint}`);
|
||||
targetList.value = response.data.data.map(item => ({
|
||||
label: item.CMNCODNAM,
|
||||
value: item.CMNCODVAL
|
||||
}));
|
||||
} catch (error) {
|
||||
console.error(`Error fetching ${endpoint}:`, error);
|
||||
targetList.value = [];
|
||||
}
|
||||
};
|
||||
|
||||
onMounted(async () => {
|
||||
await CommonCode("color", colorList);
|
||||
await CommonCode("mbti", mbtiList);
|
||||
await CommonCode("pwhint", pwhintList);
|
||||
await CommonCode("user", "color", colorList);
|
||||
await CommonCode("user", "mbti", mbtiList);
|
||||
await CommonCode("user", "pwhint", pwhintList);
|
||||
await CommonCode("project", "yearCategory", yearCategory);
|
||||
await CommonCode("worddict", "getWordCategory", cateList);
|
||||
});
|
||||
|
||||
return { colorList, mbtiList, pwhintList };
|
||||
return { colorList, mbtiList, pwhintList, yearCategory, cateList };
|
||||
};
|
||||
|
||||
export default commonApi;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user