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 globalOption = ref();
|
||||||
const ownerOption = ref<CustomerBranch[]>();
|
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(
|
async function fetchList(
|
||||||
opts?: {
|
opts?: {
|
||||||
page?: number;
|
page?: number;
|
||||||
|
|
@ -515,6 +523,7 @@ const useEmployeeStore = defineStore('api-employee', () => {
|
||||||
globalOption,
|
globalOption,
|
||||||
ownerOption,
|
ownerOption,
|
||||||
|
|
||||||
|
fetchById,
|
||||||
fetchList,
|
fetchList,
|
||||||
create,
|
create,
|
||||||
editById,
|
editById,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue