mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-02 02:29:59 +00:00
13 lines
337 B
TypeScript
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;
|