Fix not found and loading error screens

Signed-off-by: Rūdolfs Ošiņš <rudolfs@osins.org>
This commit is contained in:
Rūdolfs Ošiņš
2023-08-16 09:35:44 +02:00
parent 0e33915e9a
commit 5736083d50
15 changed files with 240 additions and 155 deletions
+4 -6
View File
@@ -1,5 +1,5 @@
import type { BaseUrl, Project } from "@httpd-client";
import type { LoadError } from "@app/lib/router/definitions";
import type { NotFoundRoute } from "@app/lib/router/definitions";
import type { WeeklyActivity } from "@app/lib/commit";
import { HttpdClient } from "@httpd-client";
@@ -81,7 +81,7 @@ export function nodePath(baseUrl: BaseUrl) {
export async function loadNodeRoute(
params: NodesRouteParams,
): Promise<NodesLoadedRoute | LoadError> {
): Promise<NodesLoadedRoute | NotFoundRoute> {
const api = new HttpdClient(params.baseUrl);
try {
const projectPageIndex = 0;
@@ -102,11 +102,9 @@ export async function loadNodeRoute(
};
} catch (error: any) {
return {
resource: "loadError",
resource: "notFound",
params: {
title: `${params.baseUrl.hostname}:${params.baseUrl.port}`,
errorMessage: "Not able to query this node.",
stackTrace: error.stack,
title: "Node not found",
},
};
}