refactor: add get api by id of employee
This commit is contained in:
parent
22093c5798
commit
39276bd4cc
1 changed files with 9 additions and 0 deletions
|
|
@ -22,6 +22,14 @@ const useEmployeeStore = defineStore('api-employee', () => {
|
|||
const globalOption = ref();
|
||||
const ownerOption = ref<CustomerBranch[]>();
|
||||
|
||||
async function fetchById(id: string) {
|
||||
const res = await api.get<Employee>(`/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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue