Сборка фронт части
This commit is contained in:
parent
43f0bc1cdc
commit
dfbd387fae
176 changed files with 7839 additions and 1032 deletions
19
FRONT/BUILD/resources/app/src/utils/checkAdmin.ts
Normal file
19
FRONT/BUILD/resources/app/src/utils/checkAdmin.ts
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
import { useIpStore } from "../store";
|
||||
import { useAdminStore } from "../store/adminStore";
|
||||
import { NetworkService } from "../api/request";
|
||||
|
||||
export const useCheckAdmin = () => {
|
||||
const { ipAddress } = useIpStore()
|
||||
const { setAdmin } = useAdminStore()
|
||||
|
||||
return async () => {
|
||||
const response = await NetworkService.whoami(ipAddress);
|
||||
console.log(response.data);
|
||||
if(response.status == 401){
|
||||
setAdmin(false)
|
||||
}
|
||||
else{
|
||||
setAdmin(response.data.user.is_admin);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue