Skip to content

Commit 0791c4e

Browse files
committed
Fix prefix root parsing
1 parent c1fd44e commit 0791c4e

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

client/src/onload/getRootFromIndexLink.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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="/"]

client/src/onload/loadConfig.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
// loadConfig.ts
2+
import { getRootFromIndexLink } from "@/onload/getRootFromIndexLink";
3+
24
let cachedConfig = null;
35

46
export 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

2023
export 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
}

0 commit comments

Comments
 (0)