localhost-front/src/stores/useProjectStore.js
2025-02-25 14:18:20 +09:00

31 lines
825 B
JavaScript

/*
작성자 : 박지윤
작성일 : 2025-02-25
수정자 :
수정일 :
설명 : 프로젝트 목록
*/
import { defineStore } from 'pinia';
import { ref } from 'vue';
import $api from '@api';
export const useProjectStore = defineStore('project', () => {
const projectList = ref([]);
const getProjectList = async (searchText, selectedYear) => {
try {
const res = await $api.get('project/select', {
params: {
searchKeyword: searchText,
category: selectedYear,
},
});
projectList.value = res.data.data.projectList;
} catch (error) {
console.error('프로젝트 목록 조회 실패:', error);
}
};
return { projectList, getProjectList };
});