File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -149,7 +149,7 @@ export const makeConfig = (env: EnvironmentService) =>
149
149
. string ( 'DEFAULT_TIMEZONE' )
150
150
. optional ( 'America/Chicago' ) ;
151
151
152
- frontendUrl = env . string ( 'FRONTEND_URL' ) . optional ( 'http://localhost:3001' ) ;
152
+ frontendUrl = env . url ( 'FRONTEND_URL' ) . optional ( 'http://localhost:3001' ) ;
153
153
154
154
neo4j = ( ( ) => {
155
155
const driverConfig : Neo4JDriverConfig = { } ;
Original file line number Diff line number Diff line change 1
1
import { createContext , type ReactElement , useContext } from 'react' ;
2
2
import { ServerException } from '~/common/exceptions' ;
3
3
4
- const FrontendUrlContext = createContext < string | undefined > ( undefined ) ;
4
+ const FrontendUrlContext = createContext < Readonly < URL > | undefined > ( undefined ) ;
5
5
6
6
export const useFrontendUrl = ( path : string ) => {
7
7
const base = useContext ( FrontendUrlContext ) ;
8
8
if ( ! base ) {
9
9
throw new ServerException ( 'Frontend url has not been provided' ) ;
10
10
}
11
- return base + path ;
11
+ path = path . startsWith ( '/' ) ? path . slice ( 1 ) : path ;
12
+ return new URL ( path , base ) . toString ( ) ;
12
13
} ;
13
14
14
- export const FrontendUrlWrapper = ( url : string ) => ( el : ReactElement ) =>
15
+ export const FrontendUrlWrapper = ( url : Readonly < URL > ) => ( el : ReactElement ) =>
15
16
< FrontendUrlContext . Provider value = { url } > { el } </ FrontendUrlContext . Provider > ;
You can’t perform that action at this time.
0 commit comments