mirror of
https://github.com/YunoHost/yunohost-portal.git
synced 2024-09-03 20:06:23 +02:00
throw page error if error not 400
This commit is contained in:
parent
7c513154eb
commit
c898122abe
3 changed files with 9 additions and 2 deletions
|
@ -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>
|
||||||
|
|
|
@ -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
|
||||||
}>(),
|
}>(),
|
||||||
{
|
{
|
||||||
|
|
|
@ -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,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue