фронт
This commit is contained in:
parent
eb1f18f53e
commit
d67ea17fd7
160 changed files with 2611 additions and 5680 deletions
|
|
@ -1,20 +0,0 @@
|
|||
import { useIpStore } from "../store";
|
||||
import { useAdminStore } from "../store/adminStore";
|
||||
import { useEffect } from "react";
|
||||
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