throw page error if error not 400

This commit is contained in:
axolotle 2023-08-28 15:08:33 +02:00
parent 7c513154eb
commit c898122abe
3 changed files with 9 additions and 2 deletions

View file

@ -5,9 +5,9 @@ const props = defineProps<{
</script>
<template>
<h2 id="main-target" tabindex="-1" class="text-4xl font-bold mb-3">
<h1 id="main-target" tabindex="-1" class="text-4xl font-bold mb-3">
<slot name="default">
{{ text }}
</slot>
</h2>
</h1>
</template>

View file

@ -7,6 +7,7 @@ const props = withDefaults(
icon?: string
iconSize?: string
iconOnly?: boolean
iconClass?: string
block?: boolean
}>(),
{

View file

@ -40,6 +40,12 @@ export function useApi<T>(
if (e.statusCode === 401) {
useIsLoggedIn().value = false
navigateTo('/login')
} else if (e.statusCode !== 400 && !e.data?.path) {
throw createError({
statusCode: e.statusCode,
statusMessage: e.message,
fatal: true,
})
}
})
}