Error handling (#121)

This commit is contained in:
Geometrically
2023-05-22 18:11:31 -07:00
committed by GitHub
parent 6014172046
commit 1b47eb71e1
36 changed files with 271 additions and 198 deletions

View File

@@ -0,0 +1,10 @@
import { ofetch } from 'ofetch'
import { handleError } from '@/store/state.js'
export const useFetch = async (url, item) => {
try {
return await ofetch(url)
} catch (err) {
handleError({ message: `Error fetching ${item}` })
}
}