Skip to content

Commit 4e7122b

Browse files
committed
Correct fix for swagger docs json.
1 parent e0f20b4 commit 4e7122b

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

cda-gui/src/main.jsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Routing
22
import React from "react";
33
import ReactDOM from "react-dom/client";
4-
import { Link, createBrowserRouter, RouterProvider } from "react-router-dom";
4+
import { Link, createBrowserRouter, RouterProvider, href } from "react-router-dom";
55

66
import { LinkProvider } from "@usace/groundwork";
77
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
@@ -21,6 +21,7 @@ import ErrorFallback from "./pages/ErrorFallback";
2121
import FilterExpressions from "./pages/rsql";
2222
import Timestamps from "./pages/timestamps";
2323
import LegacyFormat from "./pages/legacy-format/index.jsx";
24+
import { getBasePath } from "./utils/base.js";
2425

2526
const queryClient = new QueryClient();
2627

@@ -36,6 +37,16 @@ const router = createBrowserRouter(
3637
path: "swagger-ui",
3738
element: <SwaggerUI />,
3839
},
40+
{
41+
path: "swagger-docs",
42+
// yes, this is a bit odd, but the swagger-docs are "rendered" by the api backend, not client side.
43+
loader: () => {
44+
const h = href(getBasePath() + "/swagger-docs");
45+
globalThis.location.replace(h);
46+
return null;
47+
},
48+
component: <div />,
49+
},
3950
{ path: "data-query", element: <DataQuery /> },
4051
{ path: "regexp", element: <Regexp /> },
4152
{ path: "filter-expressions", element: <FilterExpressions /> },

0 commit comments

Comments
 (0)