Skip to content

Commit

Permalink
Use fetch and catch error
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertBroersma committed Nov 27, 2023
1 parent 69259c5 commit 55f51d1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,12 @@ console.log({ baseURL })
let catalogPath = `${baseURL}/catalog.json`
let { data: catalogJson } = await useAsyncData<CatalogType>(() =>
$fetch(catalogPath),
fetch(catalogPath)
.then((res) => res.json())
.catch((err) => {
console.error(err)
return null
}),
)
let catalog = catalogJson.value
Expand Down

0 comments on commit 55f51d1

Please sign in to comment.