feat: branch userStats (store, type)

This commit is contained in:
puriphatt 2024-04-10 13:59:13 +07:00
parent 44b3fa97aa
commit e2b954965e
2 changed files with 32 additions and 0 deletions

View file

@ -225,6 +225,29 @@ const useBranchStore = defineStore('api-branch', () => {
return false;
}
async function userStats(
userType: string,
flow?: {
sessionId: string;
refTransactionId: string;
transactionId: string;
},
) {
const res = await api.get(`/branch/user-stats`, {
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;
return false;
}
return {
data,
fetchList,
@ -237,6 +260,8 @@ const useBranchStore = defineStore('api-branch', () => {
getUser,
addUser,
removeUser,
userStats,
};
});

View file

@ -47,3 +47,10 @@ export type BranchCreate = {
provinceId?: string | null;
headOfficeId?: string | null;
};
export type BranchUserStats = {
id: string,
nameEN: string,
name: string;
count: 0
}