File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -24,10 +24,13 @@ export default function Home() {
2424 } , 100 ) ;
2525 }
2626
27- const logicTreeFile = '/data/logicTrees.json' ;
27+ const basePath = import . meta. env . BASE_URL ;
28+ const prefix = basePath . endsWith ( '/' ) ? basePath . slice ( 0 , - 1 ) : basePath ;
29+
30+ const logicTreeFile = `${ prefix } /data/logicTrees.json` ;
2831 Promise . all ( [
2932 fetch ( logicTreeFile ) . then ( res => res . json ( ) ) ,
30- fetch ( ' /data/urlMap.json' ) . then ( res => res . json ( ) )
33+ fetch ( ` ${ prefix } /data/urlMap.json` ) . then ( res => res . json ( ) )
3134 ] )
3235 . then ( ( [ data , map ] ) => {
3336 if ( data && data . LOGIC_TREES ) {
Original file line number Diff line number Diff line change @@ -18,13 +18,16 @@ export default function Quiz() {
1818
1919 // 1. Fetch Data (Static JSONs)
2020 useEffect ( ( ) => {
21+ const basePath = import . meta. env . BASE_URL ;
22+ const prefix = basePath . endsWith ( '/' ) ? basePath . slice ( 0 , - 1 ) : basePath ;
23+
2124 // ALWAYS fetch the main logicTrees.json, which now contains keys.
2225 // The text content is in the locale files loaded by LanguageContext.
23- const logicTreeFile = ' /data/logicTrees.json' ;
26+ const logicTreeFile = ` ${ prefix } /data/logicTrees.json` ;
2427
2528 Promise . all ( [
2629 fetch ( logicTreeFile ) . then ( res => res . json ( ) ) ,
27- fetch ( ' /data/urlMap.json' ) . then ( res => res . json ( ) )
30+ fetch ( ` ${ prefix } /data/urlMap.json` ) . then ( res => res . json ( ) )
2831 ] )
2932 . then ( ( [ logic , map ] ) => {
3033 setLogicData ( logic ) ;
You can’t perform that action at this time.
0 commit comments