diff --git a/src/stores/employee/index.ts b/src/stores/employee/index.ts index fd8ca3c5..a4d2c44b 100644 --- a/src/stores/employee/index.ts +++ b/src/stores/employee/index.ts @@ -22,6 +22,14 @@ const useEmployeeStore = defineStore('api-employee', () => { const globalOption = ref(); const ownerOption = ref(); + async function fetchById(id: string) { + const res = await api.get(`/employee/${id}`); + if (res && res.status === 200) { + return res.data; + } + return false; + } + async function fetchList( opts?: { page?: number; @@ -515,6 +523,7 @@ const useEmployeeStore = defineStore('api-employee', () => { globalOption, ownerOption, + fetchById, fetchList, create, editById,