feat: add params
This commit is contained in:
parent
0fb882b308
commit
0c3eeef35e
1 changed files with 5 additions and 14 deletions
|
|
@ -46,23 +46,14 @@ const useEmployeeStore = defineStore('api-employee', () => {
|
|||
query?: string;
|
||||
gender?: string;
|
||||
status?: Status;
|
||||
passport?: boolean;
|
||||
visa: boolean;
|
||||
zipCode?: string;
|
||||
customerId?: string;
|
||||
}) {
|
||||
const params = new URLSearchParams();
|
||||
|
||||
for (const [k, v] of Object.entries(opts || {})) {
|
||||
v !== undefined && params.append(k, v.toString());
|
||||
}
|
||||
|
||||
const query = params.toString();
|
||||
|
||||
const res = await api.get<Pagination<Employee[]>>(
|
||||
`/employee${(params && '?'.concat(query)) || ''}`,
|
||||
{
|
||||
headers: { 'X-Rtid': flowStore.rtid },
|
||||
},
|
||||
);
|
||||
const res = await api.get<Pagination<Employee[]>>(`/employee`, {
|
||||
params: opts,
|
||||
});
|
||||
|
||||
if (res && res.status === 200) {
|
||||
data.value = res.data;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue