forked from abner/for-legacy-web
fix: redirect to / on empty invites
This commit is contained in:
@@ -121,7 +121,7 @@ export default function App() {
|
|||||||
<Route path="/friends" component={Friends} />
|
<Route path="/friends" component={Friends} />
|
||||||
<Route path="/open/:id" component={Open} />
|
<Route path="/open/:id" component={Open} />
|
||||||
<Route path="/bot/:id" component={InviteBot} />
|
<Route path="/bot/:id" component={InviteBot} />
|
||||||
<Route path="/invite/:code" component={Invite} />
|
<Route path="/invite/:code?" component={Invite} />
|
||||||
<Route path="/" component={Home} />
|
<Route path="/" component={Home} />
|
||||||
</Switch>
|
</Switch>
|
||||||
</Routes>
|
</Routes>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { ArrowBack } from "@styled-icons/boxicons-regular";
|
import { ArrowBack } from "@styled-icons/boxicons-regular";
|
||||||
import { autorun } from "mobx";
|
import { autorun } from "mobx";
|
||||||
import { useHistory, useParams } from "react-router-dom";
|
import { Redirect, useHistory, useParams } from "react-router-dom";
|
||||||
import { RetrievedInvite } from "revolt-api/types/Invites";
|
import { RetrievedInvite } from "revolt-api/types/Invites";
|
||||||
|
|
||||||
import styles from "./Invite.module.scss";
|
import styles from "./Invite.module.scss";
|
||||||
@@ -49,6 +49,8 @@ export default function Invite() {
|
|||||||
}
|
}
|
||||||
}, [client, code, invite, status]);
|
}, [client, code, invite, status]);
|
||||||
|
|
||||||
|
if (code === undefined) return <Redirect to="/" />;
|
||||||
|
|
||||||
if (typeof invite === "undefined") {
|
if (typeof invite === "undefined") {
|
||||||
return (
|
return (
|
||||||
<div className={styles.preloader}>
|
<div className={styles.preloader}>
|
||||||
|
|||||||
Reference in New Issue
Block a user