ragflow/web/src/wrappers/auth.tsx
balibabu 8b2c04abc4
Feat: If the user is not logged in, jump to the login page by refreshing. (#5451)
### 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)
2025-02-27 18:48:53 +08:00

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 <></>;
};