feat: store branch stat
This commit is contained in:
parent
06f3b2b1bb
commit
4d57c3d056
1 changed files with 32 additions and 7 deletions
|
|
@ -226,6 +226,28 @@ const useBranchStore = defineStore('api-branch', () => {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function stats(flow?: {
|
||||||
|
sessionId: string;
|
||||||
|
refTransactionId: string;
|
||||||
|
transactionId: string;
|
||||||
|
}) {
|
||||||
|
const res = await api.get<{
|
||||||
|
hq: number;
|
||||||
|
br: number;
|
||||||
|
}>(`/branch/stats`, {
|
||||||
|
headers: {
|
||||||
|
'X-Session-Id': flow?.sessionId,
|
||||||
|
'X-Rtid': flow?.refTransactionId,
|
||||||
|
'X-Tid': flow?.transactionId,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!res) return false;
|
||||||
|
if (res.status === 200) return res.data;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
async function userStats(
|
async function userStats(
|
||||||
userType: string,
|
userType: string,
|
||||||
flow?: {
|
flow?: {
|
||||||
|
|
@ -234,14 +256,16 @@ const useBranchStore = defineStore('api-branch', () => {
|
||||||
transactionId: string;
|
transactionId: string;
|
||||||
},
|
},
|
||||||
) {
|
) {
|
||||||
const res = await api.get(`/branch/user-stats`, {
|
const res = await api.get(
|
||||||
headers: {
|
`/branch/user-stats${userType ? '?'.concat(userType) : ''}`,
|
||||||
'X-Session-Id': flow?.sessionId,
|
{
|
||||||
'X-Rtid': flow?.refTransactionId,
|
headers: {
|
||||||
'X-Tid': flow?.transactionId,
|
'X-Session-Id': flow?.sessionId,
|
||||||
|
'X-Rtid': flow?.refTransactionId,
|
||||||
|
'X-Tid': flow?.transactionId,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
data: userType,
|
);
|
||||||
});
|
|
||||||
|
|
||||||
if (!res) return false;
|
if (!res) return false;
|
||||||
if (res.status === 200) return res.data;
|
if (res.status === 200) return res.data;
|
||||||
|
|
@ -262,6 +286,7 @@ const useBranchStore = defineStore('api-branch', () => {
|
||||||
addUser,
|
addUser,
|
||||||
removeUser,
|
removeUser,
|
||||||
|
|
||||||
|
stats,
|
||||||
userStats,
|
userStats,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue