feat: prevent the user from entering the knowledge base if he is not logged in (#45)

This commit is contained in:
balibabu
2024-01-29 19:28:39 +08:00
committed by GitHub
parent e1bc1d46e6
commit 04aba1bb65
20 changed files with 700 additions and 591 deletions

10
web/src/hooks/authHook.ts Normal file
View File

@ -0,0 +1,10 @@
import authorizationUtil from '@/utils/authorizationUtil';
import { useState } from 'react';
export const useAuth = () => {
const [isLogin, setIsLogin] = useState(
() => !!authorizationUtil.getAuthorization(),
);
return { isLogin };
};