forked from abner/for-legacy-web
fix(invite): allow logged out users to view invites
This commit is contained in:
@@ -7,6 +7,8 @@ import { useClient } from "./RevoltClient";
|
||||
|
||||
interface Props {
|
||||
auth?: boolean;
|
||||
blockRender?: boolean;
|
||||
|
||||
children: Children;
|
||||
}
|
||||
|
||||
@@ -16,8 +18,10 @@ export const CheckAuth = (props: Props) => {
|
||||
const ready = auth.isLoggedIn() && !!client?.user;
|
||||
|
||||
if (props.auth && !ready) {
|
||||
if (props.blockRender) return null;
|
||||
return <Redirect to="/login" />;
|
||||
} else if (!props.auth && ready) {
|
||||
if (props.blockRender) return null;
|
||||
return <Redirect to="/" />;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user