Files
AstralRinth/theseus_gui/src/helpers/fetch.js
Geometrically 1e78a7b6a8 Analytics + more bug fixes (#144)
* Analytics + more bug fixes

* debug deadlock

* Fix mostly everything

* merge fixes

* fix rest

* final fixeS
2023-06-19 14:59:06 -07:00

14 lines
351 B
JavaScript

import { ofetch } from 'ofetch'
import { handleError } from '@/store/state.js'
export const useFetch = async (url, item) => {
try {
return await ofetch(url, {
headers: { 'User-Agent': 'modrinth/theseus (support@modrinth.com)' },
})
} catch (err) {
handleError({ message: `Error fetching ${item}` })
console.error(err)
}
}