fix api fetch

This commit is contained in:
isUnknown 2024-09-11 06:09:34 +02:00
parent 2960614fa4
commit 5e3f4ec621
2 changed files with 5 additions and 5 deletions

View file

@ -5,8 +5,7 @@ accept:
type: image
fields:
favoriteForClients:
favoriteForUsers:
label: |
Dans les favoris des clients :
type: pages
query: page('clients').children
Dans les favoris des utilisateurs :
type: users

View file

@ -32,8 +32,9 @@ export const useApiStore = defineStore("api", () => {
*/
async function fetchPageData(path = window.location.pathname) {
const isHomePage = path === "/";
path = isHomePage ? "/home" : path;
path = path === "/" ? "/home" : path;
path = path.startsWith("/") ? path : "/" + path;
path = path.endsWith("/") ? path.substring(0, path.length - 1) : path;
const url = `${window.location.origin}${path}.json`;