mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-29 10:10:30 +08:00
Fix not found and loading error screens
Signed-off-by: Rūdolfs Ošiņš <rudolfs@osins.org>
This commit is contained in:
+6
-6
@@ -76,7 +76,7 @@ export async function navigateToUrl(
|
||||
} else {
|
||||
await navigate(action, {
|
||||
resource: "notFound",
|
||||
params: { url: relativeUrl },
|
||||
params: { title: "Page not found" },
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -241,8 +241,6 @@ export function routeToPath(route: Route): string {
|
||||
return `/session?id=${route.params.id}&sig=${route.params.signature}&pk=${route.params.publicKey}`;
|
||||
} else if (route.resource === "nodes") {
|
||||
return nodePath(route.params.baseUrl);
|
||||
} else if (route.resource === "loadError") {
|
||||
return "";
|
||||
} else if (
|
||||
route.resource === "project.source" ||
|
||||
route.resource === "project.history" ||
|
||||
@@ -254,10 +252,12 @@ export function routeToPath(route: Route): string {
|
||||
route.resource === "project.patch"
|
||||
) {
|
||||
return projectRouteToPath(route);
|
||||
} else if (route.resource === "booting") {
|
||||
} else if (
|
||||
route.resource === "booting" ||
|
||||
route.resource === "notFound" ||
|
||||
route.resource === "loadError"
|
||||
) {
|
||||
return "";
|
||||
} else if (route.resource === "notFound") {
|
||||
return route.params.url;
|
||||
} else {
|
||||
return utils.unreachable(route);
|
||||
}
|
||||
|
||||
@@ -13,9 +13,9 @@ interface BootingRoute {
|
||||
resource: "booting";
|
||||
}
|
||||
|
||||
interface NotFoundRoute {
|
||||
export interface NotFoundRoute {
|
||||
resource: "notFound";
|
||||
params: { url: string };
|
||||
params: { title: string };
|
||||
}
|
||||
|
||||
interface SessionRoute {
|
||||
@@ -23,10 +23,10 @@ interface SessionRoute {
|
||||
params: { id: string; signature: string; publicKey: string };
|
||||
}
|
||||
|
||||
export interface LoadError {
|
||||
export interface LoadErrorRoute {
|
||||
resource: "loadError";
|
||||
params: {
|
||||
title?: string;
|
||||
title: string;
|
||||
errorMessage: string;
|
||||
stackTrace: string;
|
||||
};
|
||||
@@ -35,7 +35,7 @@ export interface LoadError {
|
||||
export type Route =
|
||||
| BootingRoute
|
||||
| HomeRoute
|
||||
| LoadError
|
||||
| LoadErrorRoute
|
||||
| NotFoundRoute
|
||||
| ProjectRoute
|
||||
| NodesRoute
|
||||
@@ -44,7 +44,7 @@ export type Route =
|
||||
export type LoadedRoute =
|
||||
| BootingRoute
|
||||
| HomeLoadedRoute
|
||||
| LoadError
|
||||
| LoadErrorRoute
|
||||
| NotFoundRoute
|
||||
| ProjectLoadedRoute
|
||||
| NodesLoadedRoute
|
||||
|
||||
Reference in New Issue
Block a user