Update stores/api.js: remove slash for url to work with Inspirations, but need to fix for Home

This commit is contained in:
Timothée Goguely 2024-09-09 20:08:13 +02:00
parent dc4abf68a6
commit 550da7fb47

View file

@ -31,10 +31,13 @@ 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`;
: `${window.location.origin}${path}.json`;
try {
const response = await fetch(url);