Added href check to services page since href is now optional

This commit is contained in:
Neshura 2023-03-16 22:19:33 +01:00
parent 691a0ed881
commit f6258df5a2
Signed by: Neshura
GPG key ID: B6983AAA6B9A7A6C

View file

@ -4,7 +4,7 @@ import { ReactElement } from 'react'
import useSWR from 'swr';
import ServiceList from '../public/data/pages.json';
import { DockerInfo } from '../interfaces/DockerStatus';
import { CardContentService, PageContentBox, PageDescription, PageTitle } from '../components/styles/content';
import { PageContentBox, PageDescription, PageTitle } from '../components/styles/content';
import useWindowSize from '../components/windowsize';
import { ServiceCardMobile } from '../components/styles/cards/mobile';
import { ServiceCardDesktop } from '../components/styles/cards/desktop';
@ -85,7 +85,7 @@ async function getStatus(entry: Service, containers: DockerInfo[]) {
// Others to follow but low prio as this is currently the only location used
// Type APP
if (entry.type === ServiceType.app) {
if (entry.type === ServiceType.app && entry.href) {
await fetch(entry.href)
.then((response) => {
if (response.ok) {
@ -126,10 +126,10 @@ async function getStatus(entry: Service, containers: DockerInfo[]) {
default:
console.log("Container Status " + container.status + " has no case implemented");
entry.status = Status.offline;
}
found = true;
// cancel the for
break;
}
found = true;
// cancel the for
break;
}
}
// If container name is not missing the container is set to offline