lemmy-ui/src/shared/components/common/auth-guard.tsx
2023-05-14 11:08:06 -04:00

13 lines
337 B
TypeScript

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="/" />;
} else {
return <>{props.children}</>;
}
}
export default AuthGuard;