refactor: add opts headOfficeId

This commit is contained in:
Net 2024-09-06 17:25:22 +07:00
parent 8a2c94028b
commit 0a8d9cf143

View file

@ -260,12 +260,20 @@ const useBranchStore = defineStore('api-branch', () => {
return false;
}
async function stats() {
async function stats(opts?: { headOfficeId?: 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<{
hq: number;
br: number;
virtual: number;
}>('/branch/stats', {
}>(`/branch/stats${(params && '?'.concat(query)) || ''}`, {
headers: {
'X-Rtid': flowStore.rtid,
},