mirror of
https://github.com/revoltchat/revite.git
synced 2024-11-10 01:03:36 -05:00
fix: redirect to / on empty invites
This commit is contained in:
parent
4787a2166f
commit
8185b59771
2 changed files with 4 additions and 2 deletions
|
@ -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>
|
||||
|
|
|
@ -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}>
|
||||
|
|
Loading…
Reference in a new issue