Merge pull request #210 from goaaats/fix/empty_invite_redirect

This commit is contained in:
Paul Makles 2021-09-09 21:06:27 +01:00 committed by GitHub
commit f4b54c2f64
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View file

@ -121,7 +121,7 @@ export default function App() {
<Route path="/friends" component={Friends} />
<Route path="/open/:id" component={Open} />
<Route path="/bot/:id" component={InviteBot} />
<Route path="/invite/:code" component={Invite} />
<Route path="/invite/:code?" component={Invite} />
<Route path="/" component={Home} />
</Switch>
</Routes>

View file

@ -1,6 +1,6 @@
import { ArrowBack } from "@styled-icons/boxicons-regular";
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 styles from "./Invite.module.scss";
@ -49,6 +49,8 @@ export default function Invite() {
}
}, [client, code, invite, status]);
if (code === undefined) return <Redirect to="/" />;
if (typeof invite === "undefined") {
return (
<div className={styles.preloader}>