mirror of
https://github.com/stoatchat/for-legacy-web.git
synced 2026-03-06 17:11:55 +00:00
fix: allow invite screen to properly load while signed out
This commit is contained in:
@@ -3,6 +3,7 @@ import { Route, Switch } from "react-router-dom";
|
||||
import { lazy, Suspense } from "preact/compat";
|
||||
|
||||
import ErrorBoundary from "../lib/ErrorBoundary";
|
||||
import FakeClient from "../lib/FakeClient";
|
||||
|
||||
import Context from "../context";
|
||||
import { CheckAuth } from "../context/revoltjs/CheckAuth";
|
||||
@@ -31,7 +32,9 @@ export function App() {
|
||||
<Login />
|
||||
</Route>
|
||||
<Route path="/invite/:code">
|
||||
<Invite />
|
||||
<FakeClient>
|
||||
<Invite />
|
||||
</FakeClient>
|
||||
</Route>
|
||||
<Route path="/login">
|
||||
<CheckAuth>
|
||||
|
||||
@@ -10,6 +10,8 @@ import { useContext, useEffect, useState } from "preact/hooks";
|
||||
import { defer } from "../../lib/defer";
|
||||
import { TextReact } from "../../lib/i18n";
|
||||
|
||||
import { useApplicationState } from "../../mobx/State";
|
||||
|
||||
import RequiresOnline from "../../context/revoltjs/RequiresOnline";
|
||||
import {
|
||||
AppContext,
|
||||
@@ -27,6 +29,7 @@ import Preloader from "../../components/ui/Preloader";
|
||||
export default function Invite() {
|
||||
const history = useHistory();
|
||||
const client = useContext(AppContext);
|
||||
|
||||
const status = useContext(StatusContext);
|
||||
const { code } = useParams<{ code: string }>();
|
||||
const [processing, setProcessing] = useState(false);
|
||||
@@ -36,10 +39,7 @@ export default function Invite() {
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (
|
||||
typeof invite === "undefined" &&
|
||||
(status === ClientStatus.ONLINE || status === ClientStatus.READY)
|
||||
) {
|
||||
if (typeof invite === "undefined") {
|
||||
client
|
||||
.fetchInvite(code)
|
||||
.then((data) => setInvite(data))
|
||||
@@ -91,7 +91,7 @@ export default function Invite() {
|
||||
className={styles.invite}
|
||||
style={{
|
||||
backgroundImage: invite.server_banner
|
||||
? `url('${client.generateFileURL(invite.server_banner)}')`
|
||||
? `url('${client?.generateFileURL(invite.server_banner)}')`
|
||||
: undefined,
|
||||
}}>
|
||||
<div className={styles.leave}>
|
||||
|
||||
Reference in New Issue
Block a user