mirror of
https://github.com/revoltchat/revite.git
synced 2024-12-26 23:42:11 -05:00
Merge pull request #210 from goaaats/fix/empty_invite_redirect
This commit is contained in:
commit
f4b54c2f64
2 changed files with 4 additions and 2 deletions
|
@ -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}>
|
||||||
|
|
Loading…
Reference in a new issue