lemmy-ui/src/shared/components/common/auth-guard.tsx

14 lines
342 B
TypeScript
Raw Normal View History

2023-05-14 15:08:06 +00:00
import { InfernoNode } from "inferno";
import { Redirect } from "inferno-router";
import { UserService } from "../../services";
function AuthGuard(props: { children?: InfernoNode }) {
if (!UserService.Instance.myUserInfo) {
return <Redirect to="/login" />;
2023-05-14 15:08:06 +00:00
} else {
return <>{props.children}</>;
}
}
export default AuthGuard;