mirror of
https://github.com/DI0IK/homepage-plus.git
synced 2025-07-13 16:30:31 +00:00
Add detailed Error component for service widgets
This commit is contained in:
parent
7b7740563e
commit
21017e4716
37 changed files with 113 additions and 113 deletions
|
@ -1,19 +1,16 @@
|
|||
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: indexersData, error: indexersError } = useWidgetAPI(widget, "indexer");
|
||||
const { data: grabsData, error: grabsError } = useWidgetAPI(widget, "indexerstats");
|
||||
|
||||
if (indexersError || grabsError) {
|
||||
return <Container error={t("widget.api_error")} />;
|
||||
if (indexersError || indexersData?.error || grabsError || grabsData?.error) {
|
||||
const finalError = indexersError ?? indexersData?.error ?? grabsError ?? grabsData?.error;
|
||||
return <Container error={finalError} />;
|
||||
}
|
||||
|
||||
if (!indexersData || !grabsData) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue