11// Routing
22import React from "react" ;
33import 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
66import { LinkProvider } from "@usace/groundwork" ;
77import { QueryClient , QueryClientProvider } from "@tanstack/react-query" ;
@@ -21,6 +21,7 @@ import ErrorFallback from "./pages/ErrorFallback";
2121import FilterExpressions from "./pages/rsql" ;
2222import Timestamps from "./pages/timestamps" ;
2323import LegacyFormat from "./pages/legacy-format/index.jsx" ;
24+ import { getBasePath } from "./utils/base.js" ;
2425
2526const 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