You've already forked AstralRinth
forked from didirus/AstralRinth
* fix: app fetch * fix: webp default images * fix: lint issues * feat: remove default thumbnail from app assets * fix: webp paths * fix: use ` instead of "/' * fix: use AutoLink * Fix featured article link + changelog page --------- Co-authored-by: Prospector <prospectordev@gmail.com>
19 lines
525 B
JavaScript
19 lines
525 B
JavaScript
import { fetch } from '@tauri-apps/plugin-http'
|
|
import { handleError } from '@/store/state.js'
|
|
import { getVersion } from '@tauri-apps/api/app'
|
|
|
|
export const useFetch = async (url, item, isSilent) => {
|
|
try {
|
|
const version = await getVersion()
|
|
return await fetch(url, {
|
|
method: 'GET',
|
|
headers: { 'User-Agent': `modrinth/theseus/${version} (support@modrinth.com)` },
|
|
})
|
|
} catch (err) {
|
|
if (!isSilent) {
|
|
handleError({ message: `Error fetching ${item}` })
|
|
}
|
|
console.error(err)
|
|
}
|
|
}
|