feat: improve handling of an invalid api url

Resolves vikunja/frontend#1964
This commit is contained in:
kolaente 2023-07-05 17:46:52 +02:00
parent 7c1934aad0
commit 24ad2f892d
Signed by untrusted user: konrad
GPG Key ID: F40E70337AB24C9B
2 changed files with 20 additions and 16 deletions

View File

@ -13,7 +13,7 @@
<section class="content"> <section class="content">
<div> <div>
<h2 class="title" v-if="title">{{ title }}</h2> <h2 class="title" v-if="title">{{ title }}</h2>
<api-config/> <api-config v-if="showApiConfig"/>
<Message v-if="motd !== ''" class="is-hidden-tablet mb-4"> <Message v-if="motd !== ''" class="is-hidden-tablet mb-4">
{{ motd }} {{ motd }}
</Message> </Message>
@ -45,6 +45,12 @@ const route = useRoute()
const {t} = useI18n({useScope: 'global'}) const {t} = useI18n({useScope: 'global'})
const title = computed(() => t(route.meta?.title as string || '')) const title = computed(() => t(route.meta?.title as string || ''))
useTitle(() => title.value) useTitle(() => title.value)
const {
showApiConfig = true,
} = defineProps<{
showApiConfig?: boolean
}>()
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -11,22 +11,20 @@
<slot/> <slot/>
</template> </template>
<section v-else-if="error !== ''"> <section v-else-if="error !== ''">
<no-auth-wrapper> <no-auth-wrapper :show-api-config="false">
<card> <p v-if="error === ERROR_NO_API_URL">
<p v-if="error === ERROR_NO_API_URL"> {{ $t('ready.noApiUrlConfigured') }}
{{ $t('ready.noApiUrlConfigured') }} </p>
<message variant="danger" v-else class="mb-4">
<p>
{{ $t('ready.errorOccured') }}<br/>
{{ error }}
</p> </p>
<message variant="danger" v-else> <p>
<p> {{ $t('ready.checkApiUrl') }}
{{ $t('ready.errorOccured') }}<br/> </p>
{{ error }} </message>
</p> <api-config :configure-open="true" @found-api="load"/>
<p>
{{ $t('ready.checkApiUrl') }}
</p>
</message>
<api-config :configure-open="true" @found-api="load"/>
</card>
</no-auth-wrapper> </no-auth-wrapper>
</section> </section>
<CustomTransition name="fade"> <CustomTransition name="fade">