Skip to content

Commit

Permalink
fix(flow): error flow in initializing masonry object due to fetch on …
Browse files Browse the repository at this point in the history
…data.json fail
  • Loading branch information
raiyanu committed May 25, 2024
1 parent c4ae6cf commit 0c86e56
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions js/content-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ async function fetchContentData(dataPath) {
} catch (error) {
console.error("Fetch error:", error);
if (errCount == 0) {
fetchContentData("/foodie-site/data.json");
fetchContentData("../data.json");
errCount++;
}
}
await masonry_init();
}
let errCount = 0;
function appendMenuData(data) {
Expand Down Expand Up @@ -72,6 +73,5 @@ function appendMenuData(data) {
}

document.addEventListener("DOMContentLoaded", async function () {
await fetchContentData("../data.json");
await masonry_init();
await fetchContentData("/foodie-site/data.json");
});

0 comments on commit 0c86e56

Please sign in to comment.