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> </script>
<template> <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"> <slot name="default">
{{ text }} {{ text }}
</slot> </slot>
</h2> </h1>
</template> </template>

View file

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

View file

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