Add missing error handling

This commit is contained in:
schroda
2024-04-27 22:28:55 +02:00
parent a447719309
commit 773d2b1026
20 changed files with 322 additions and 65 deletions

View File

@@ -28,6 +28,7 @@ import { NavBarContext, useSetDefaultBackTo } from '@/components/context/NavbarC
import { LoadingPlaceholder } from '@/components/util/LoadingPlaceholder';
import { GetAboutQuery, UpdateState } from '@/lib/graphql/generated/graphql.ts';
import { defaultPromiseErrorHandler } from '@/util/defaultPromiseErrorHandler.ts';
import { EmptyView } from '@/components/util/EmptyView.tsx';
type AboutServer = GetAboutQuery['aboutServer'];
@@ -201,7 +202,7 @@ export function About() {
useSetDefaultBackTo('settings');
const { data, loading } = requestManager.useGetAbout();
const { data, loading, error, refetch } = requestManager.useGetAbout({ notifyOnNetworkStatusChange: true });
const { aboutServer, aboutWebUI } = data ?? {};
const {
@@ -239,6 +240,16 @@ export function About() {
return <LoadingPlaceholder />;
}
if (error) {
return (
<EmptyView
message={t('global.error.label.failed_to_load_data')}
messageExtra={error.message}
retry={() => refetch().catch(defaultPromiseErrorHandler('About::refetch'))}
/>
);
}
return (
<List>
<List