Skip to content

Commit

Permalink
Locate data.json if deployed to a subroute
Browse files Browse the repository at this point in the history
  • Loading branch information
dokempf committed Oct 17, 2024
1 parent cff9160 commit 88f9392
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/lib/stores.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ function derivedPromise(store) {

// Our pregenerated defaults wrapped in a Promise
async function pregenDefaults() {
const response = await fetch(`/pregen/data.json`);
const baseUrl = window.location.origin + window.location.pathname.replace(/\/[^/]*$/, '');
const response = await fetch(`${baseUrl}/pregen/data.json`);
return response.json();
}

Expand Down

0 comments on commit 88f9392

Please sign in to comment.