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;
|
||||
}
|
||||
|
||||
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(
|
||||
userType: string,
|
||||
flow?: {
|
||||
|
|
@ -234,14 +256,16 @@ const useBranchStore = defineStore('api-branch', () => {
|
|||
transactionId: string;
|
||||
},
|
||||
) {
|
||||
const res = await api.get(`/branch/user-stats`, {
|
||||
headers: {
|
||||
'X-Session-Id': flow?.sessionId,
|
||||
'X-Rtid': flow?.refTransactionId,
|
||||
'X-Tid': flow?.transactionId,
|
||||
const res = await api.get(
|
||||
`/branch/user-stats${userType ? '?'.concat(userType) : ''}`,
|
||||
{
|
||||
headers: {
|
||||
'X-Session-Id': flow?.sessionId,
|
||||
'X-Rtid': flow?.refTransactionId,
|
||||
'X-Tid': flow?.transactionId,
|
||||
},
|
||||
},
|
||||
data: userType,
|
||||
});
|
||||
);
|
||||
|
||||
if (!res) return false;
|
||||
if (res.status === 200) return res.data;
|
||||
|
|
@ -262,6 +286,7 @@ const useBranchStore = defineStore('api-branch', () => {
|
|||
addUser,
|
||||
removeUser,
|
||||
|
||||
stats,
|
||||
userStats,
|
||||
};
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue