mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-04-29 07:15:25 +08:00

### What problem does this PR solve? Feat: If the user is not logged in, jump to the login page by refreshing. ### Type of change - [x] New Feature (non-breaking change which adds functionality)
15 lines
325 B
TypeScript
15 lines
325 B
TypeScript
import { useAuth } from '@/hooks/auth-hooks';
|
|
import { redirectToLogin } from '@/utils/authorization-util';
|
|
import { Outlet } from 'umi';
|
|
|
|
export default () => {
|
|
const { isLogin } = useAuth();
|
|
if (isLogin === true) {
|
|
return <Outlet />;
|
|
} else if (isLogin === false) {
|
|
redirectToLogin();
|
|
}
|
|
|
|
return <></>;
|
|
};
|