mirror of
https://github.com/gethomepage/homepage.git
synced 2025-12-07 09:35:54 -08:00
Add detailed Error component for service widgets
This commit is contained in:
@@ -1,20 +1,17 @@
|
||||
import { useTranslation } from "next-i18next";
|
||||
|
||||
import Container from "components/services/widget/container";
|
||||
import Block from "components/services/widget/block";
|
||||
import useWidgetAPI from "utils/proxy/use-widget-api";
|
||||
|
||||
export default function Component({ service }) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const { widget } = service;
|
||||
|
||||
const { data: appsData, error: appsError } = useWidgetAPI(widget, "application");
|
||||
const { data: messagesData, error: messagesError } = useWidgetAPI(widget, "message");
|
||||
const { data: clientsData, error: clientsError } = useWidgetAPI(widget, "client");
|
||||
|
||||
if (appsError || messagesError || clientsError) {
|
||||
return <Container error={t("widget.api_error")} />;
|
||||
if (appsError || appsData?.error || messagesError || messagesData?.error || clientsError || clientsData?.error) {
|
||||
const finalError = appsError ?? appsData?.error ?? messagesError ?? messagesData?.error ?? clientsError ?? clientsData?.error;
|
||||
return <Container error={finalError} />;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user