mirror of
https://github.com/DI0IK/homepage-plus.git
synced 2025-07-10 15:28:47 +00:00
wrapped proxy calls via useWidgetAPI
This commit is contained in:
parent
649f0038bc
commit
0a58f259ff
30 changed files with 115 additions and 153 deletions
|
@ -1,18 +1,17 @@
|
|||
import useSWR from "swr";
|
||||
import { useTranslation } from "next-i18next";
|
||||
|
||||
import Container from "components/services/widget/container";
|
||||
import Block from "components/services/widget/block";
|
||||
import { formatProxyUrl } from "utils/proxy/api-helpers";
|
||||
import useWidgetAPI from "utils/proxy/use-widget-api";
|
||||
|
||||
export default function Component({ service }) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const config = service.widget;
|
||||
const { widget } = service;
|
||||
|
||||
const { data: appsData, error: appsError } = useSWR(formatProxyUrl(config, `application`));
|
||||
const { data: messagesData, error: messagesError } = useSWR(formatProxyUrl(config, `message`));
|
||||
const { data: clientsData, error: clientsError } = useSWR(formatProxyUrl(config, `client`));
|
||||
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")} />;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue