diff --git a/src/stores/api.js b/src/stores/api.js index acbc4b7..fcac154 100644 --- a/src/stores/api.js +++ b/src/stores/api.js @@ -31,13 +31,11 @@ export const useApiStore = defineStore("counter", () => { * }); */ async function fetchPageData(path = window.location.pathname) { - - // TODO: Fix url for Home AND Inspirations - const isHomePage = path === "/"; - const url = isHomePage - ? `${window.location.origin}/home.json` - : `${window.location.origin}${path}.json`; + path = isHomePage ? "/home" : path; + path = path.startsWith("/") ? path : "/" + path; + + const url = `${window.location.origin}${path}.json`; try { const response = await fetch(url);