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;
|
query?: string;
|
||||||
gender?: string;
|
gender?: string;
|
||||||
status?: Status;
|
status?: Status;
|
||||||
|
passport?: boolean;
|
||||||
|
visa: boolean;
|
||||||
zipCode?: string;
|
zipCode?: string;
|
||||||
customerId?: string;
|
customerId?: string;
|
||||||
}) {
|
}) {
|
||||||
const params = new URLSearchParams();
|
const res = await api.get<Pagination<Employee[]>>(`/employee`, {
|
||||||
|
params: opts,
|
||||||
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 },
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
if (res && res.status === 200) {
|
if (res && res.status === 200) {
|
||||||
data.value = res.data;
|
data.value = res.data;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue