wrapped proxy calls via useWidgetAPI

This commit is contained in:
Ben Phelps 2022-09-27 22:59:14 +03:00
parent 649f0038bc
commit 0a58f259ff
30 changed files with 115 additions and 153 deletions

View file

@ -151,18 +151,18 @@ function SessionEntry({ playCommand, session }) {
export default function Component({ service }) {
const { t } = useTranslation();
const config = service.widget;
const { widget } = service;
const {
data: sessionsData,
error: sessionsError,
mutate: sessionMutate,
} = useSWR(formatProxyUrl(config, "Sessions"), {
} = useSWR(formatProxyUrl(widget, "Sessions"), {
refreshInterval: 5000,
});
async function handlePlayCommand(session, command) {
const url = formatProxyUrlWithSegments(config, "PlayControl", {
const url = formatProxyUrlWithSegments(widget, "PlayControl", {
sessionId: session.Id,
command,
});