프로젝트 store 생성

This commit is contained in:
yoon 2025-02-27 11:06:25 +09:00
parent a7c27a19e4
commit bbaf744b45

View File

@ -12,19 +12,16 @@ import $api from '@api';
export const useProjectStore = defineStore('project', () => { export const useProjectStore = defineStore('project', () => {
const projectList = ref([]); const projectList = ref([]);
const getProjectList = async (searchText, selectedYear) => { const getProjectList = async (searchText = '', selectedYear = '') => {
try { const res = await $api.get('project/select', {
const res = await $api.get('project/select', { params: {
params: { searchKeyword: searchText || '',
searchKeyword: searchText, category: selectedYear || '',
category: selectedYear, },
}, });
}); projectList.value = res.data.data.projectList;
projectList.value = res.data.data.projectList;
} catch (error) {
console.error('프로젝트 목록 조회 실패:', error);
}
}; };
return { projectList, getProjectList }; return { projectList, getProjectList };
}); });