You've already forked AstralRinth
forked from didirus/AstralRinth
Error handling (#121)
This commit is contained in:
10
theseus_gui/src/helpers/fetch.js
Normal file
10
theseus_gui/src/helpers/fetch.js
Normal 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}` })
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user