mirror of
https://github.com/stoatchat/for-legacy-web.git
synced 2026-03-07 01:15:28 +00:00
Merge branch 'master' into chore/component-migration
This commit is contained in:
@@ -9,6 +9,7 @@ import { Preloader } from "@revoltchat/ui";
|
||||
|
||||
import { useApplicationState } from "../../mobx/State";
|
||||
|
||||
import Preloader from "../../components/ui/Preloader";
|
||||
import { Children } from "../../types/Preact";
|
||||
import { useIntermediate } from "../intermediate/Intermediate";
|
||||
import { registerEvents } from "./events";
|
||||
@@ -80,6 +81,7 @@ export default observer(({ children }: Props) => {
|
||||
}, [state.auth.getSession()]);
|
||||
|
||||
useEffect(() => registerEvents(state, setStatus, client), [client]);
|
||||
useEffect(() => state.registerListeners(client), [client]);
|
||||
|
||||
if (!loaded || status === ClientStatus.LOADING) {
|
||||
return <Preloader type="spinner" />;
|
||||
|
||||
@@ -22,9 +22,6 @@ export default function SyncManager() {
|
||||
}
|
||||
}, [client]);
|
||||
|
||||
// Keep data synced.
|
||||
useEffect(() => state.registerListeners(client), [client]);
|
||||
|
||||
// Take data updates from Revolt.
|
||||
useEffect(() => {
|
||||
if (!client) return;
|
||||
|
||||
@@ -7,12 +7,12 @@ import { Children } from "../../types/Preact";
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
export function takeError(error: any): string {
|
||||
if (error.response) {
|
||||
const status = error.response.status;
|
||||
if (error.response.type) {
|
||||
return error.response.type;
|
||||
const type = error.response.data?.type;
|
||||
if (type) {
|
||||
return type;
|
||||
}
|
||||
|
||||
switch (status) {
|
||||
switch (error.response.status) {
|
||||
case 429:
|
||||
return "TooManyRequests";
|
||||
case 401:
|
||||
|
||||
Reference in New Issue
Block a user