File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import { serverPath } from "@/utils/serverPath";
22
33/**
44 * Finds <link rel="index"> in head element and pulls root url fragment from
5- * there That should probably be a <base> tag instead since that's how
5+ * there. That should probably be a <base> tag instead since that's how
66 * they're using <link rel="index" />
77 *
88 * @param {string } [defaultRoot="/"]
Original file line number Diff line number Diff line change 11// loadConfig.ts
2+ import { getRootFromIndexLink } from "@/onload/getRootFromIndexLink" ;
3+
24let cachedConfig = null ;
35
46export async function loadConfig ( ) {
57 if ( ! cachedConfig ) {
68 try {
7- const response = await fetch ( "/context" ) ;
9+ const root = getRootFromIndexLink ( ) ;
10+ const response = await fetch ( `${ root } context` ) ;
811 if ( ! response . ok ) {
912 throw new Error ( `Failed to fetch /context (${ response . status } )` ) ;
1013 }
@@ -18,7 +21,7 @@ export async function loadConfig() {
1821}
1922
2023export function getAppRoot ( defaultRoot = "/" , stripTrailingSlash = false ) {
21- let root = cachedConfig ?. options ?. root || defaultRoot ;
24+ let root = cachedConfig ?. root || defaultRoot ;
2225 if ( stripTrailingSlash ) {
2326 root = root . replace ( / \/ $ / , "" ) ;
2427 }
You can’t perform that action at this time.
0 commit comments