refactor: user store
This commit is contained in:
parent
8ed96d9213
commit
2eabc5fcd7
1 changed files with 2 additions and 24 deletions
|
|
@ -206,6 +206,7 @@ const useUserStore = defineStore('api-user', () => {
|
||||||
includeBranch?: boolean;
|
includeBranch?: boolean;
|
||||||
userType?: string;
|
userType?: string;
|
||||||
status?: Status;
|
status?: Status;
|
||||||
|
responsibleDistrictId?: string;
|
||||||
},
|
},
|
||||||
flow?: {
|
flow?: {
|
||||||
sessionId?: string;
|
sessionId?: string;
|
||||||
|
|
@ -213,30 +214,7 @@ const useUserStore = defineStore('api-user', () => {
|
||||||
transactionId?: string;
|
transactionId?: string;
|
||||||
},
|
},
|
||||||
) {
|
) {
|
||||||
const params = new URLSearchParams();
|
const res = await api.get<Pagination<User[]>>(`/user`, { params: opts });
|
||||||
|
|
||||||
if (opts?.pageSize && opts?.pageSize > 0) {
|
|
||||||
params.append('pageSize', `${opts.pageSize}`);
|
|
||||||
}
|
|
||||||
if (opts?.page && opts.page > 0) params.append('page', `${opts.page}`);
|
|
||||||
if (opts?.zipCode) params.append('zipCode', opts.zipCode);
|
|
||||||
if (opts?.query) params.append('query', opts.query);
|
|
||||||
if (opts?.includeBranch) params.append('includeBranch', 'true');
|
|
||||||
if (opts?.userType) params.append('userType', opts.userType);
|
|
||||||
if (opts?.status) params.append('status', opts.status);
|
|
||||||
|
|
||||||
const query = params.toString();
|
|
||||||
|
|
||||||
const res = await api.get<Pagination<User[]>>(
|
|
||||||
`/user${(params && '?'.concat(query)) || ''}`,
|
|
||||||
{
|
|
||||||
headers: {
|
|
||||||
'X-Session-Id': flow?.sessionId,
|
|
||||||
'X-Rtid': flow?.refTransactionId || flowStore.rtid,
|
|
||||||
'X-Tid': flow?.transactionId,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
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