File tree Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Original file line number Diff line number Diff line change 1
1
import React from 'react' ;
2
2
import { BrowserRouter , Route , Routes , Navigate } from 'react-router-dom' ;
3
3
4
- import { API_VERSION_1 , API_VERSION_2 } from './config' ;
4
+ import { API_VERSION_1 , API_VERSION_2 , DEFAULT_PATH } from './config' ;
5
5
import DefaultApiRoute from './graphiql/DefaultApiRoute' ;
6
6
import Version1ApiRoute from './graphiql/Version1ApiRoute' ;
7
7
import Version2ApiRoute from './graphiql/Version2ApiRoute' ;
8
8
9
9
export default ( ) => {
10
10
return (
11
- < BrowserRouter basename = "/graphiql" >
11
+ < BrowserRouter >
12
12
< Routes >
13
- < Route path = "/" exact element = { < Navigate to = "/hsl" /> } />
14
- < Route path = "/:router" element = { < DefaultApiRoute /> } >
13
+ < Route path = "*" element = { < Navigate to = { DEFAULT_PATH } /> } />
14
+ < Route path = "/graphiql/ :router" element = { < DefaultApiRoute /> } >
15
15
< Route
16
- path = { `/:router/${ API_VERSION_1 } ` }
16
+ path = { `/graphiql/ :router/${ API_VERSION_1 } ` }
17
17
element = { < Version1ApiRoute /> }
18
18
/>
19
19
< Route
20
- path = { `/:router/${ API_VERSION_2 } /:dialect/:dialectVersion` }
20
+ path = { `/graphiql/ :router/${ API_VERSION_2 } /:dialect/:dialectVersion` }
21
21
element = { < Version2ApiRoute /> }
22
22
/>
23
23
</ Route >
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ export const API_VERSION_1 = 'v1';
2
2
export const API_VERSION_2 = 'v2' ;
3
3
export const DIALECT_VERSION_1 = 'v1' ;
4
4
export const PRODUCTION_API_URL = 'api.digitransit.fi' ;
5
+ export const DEFAULT_PATH = '/graphiql/hsl' ;
5
6
export const API_TYPE = Object . freeze ( {
6
7
DEV : 'dev' ,
7
8
PROD : 'prod' ,
You can’t perform that action at this time.
0 commit comments