Update stores/api.js: remove slash for url to work with Inspirations, but need to fix for Home
This commit is contained in:
parent
dc4abf68a6
commit
550da7fb47
1 changed files with 4 additions and 1 deletions
|
|
@ -31,10 +31,13 @@ export const useApiStore = defineStore("counter", () => {
|
||||||
* });
|
* });
|
||||||
*/
|
*/
|
||||||
async function fetchPageData(path = window.location.pathname) {
|
async function fetchPageData(path = window.location.pathname) {
|
||||||
|
|
||||||
|
// TODO: Fix url for Home AND Inspirations
|
||||||
|
|
||||||
const isHomePage = path === "/";
|
const isHomePage = path === "/";
|
||||||
const url = isHomePage
|
const url = isHomePage
|
||||||
? `${window.location.origin}/home.json`
|
? `${window.location.origin}/home.json`
|
||||||
: `${window.location.origin}/${path}.json`;
|
: `${window.location.origin}${path}.json`;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch(url);
|
const response = await fetch(url);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue