feat: check for empty url

This commit is contained in:
kolaente 2021-10-31 22:00:53 +01:00
parent acc315b581
commit a7a7c75dc5
Signed by untrusted user: konrad
GPG Key ID: F40E70337AB24C9B
2 changed files with 15 additions and 3 deletions

View File

@ -5,7 +5,10 @@
<section v-else-if="error !== ''">
<no-auth-wrapper>
<card>
<div class="notification is-danger">
<p v-if="error === errorNoApiUrl">
{{ $t('ready.noApiUrlConfigured') }}
</p>
<div class="notification is-danger" v-else>
<p>
{{ $t('ready.errorOccured') }}<br/>
{{ error }}
@ -34,6 +37,8 @@ import logoUrl from '@/assets/logo.svg'
import ApiConfig from '@/components/misc/api-config'
import NoAuthWrapper from '@/components/misc/no-auth-wrapper'
const ERROR_NO_API_URL = 'noApiUrlProvided'
export default {
name: 'ready',
components: {
@ -44,6 +49,7 @@ export default {
return {
logoUrl,
error: '',
errorNoApiUrl: ERROR_NO_API_URL,
}
},
mounted() {
@ -54,11 +60,16 @@ export default {
return this.$store.state.vikunjaReady
},
showLoading() {
return !this.ready || this.error !== ''
return !this.ready && this.error === ''
},
},
methods: {
load() {
if (window.API_URL === '') {
this.error = ERROR_NO_API_URL
return
}
this.$store.dispatch('loadApp')
.catch(e => {
this.error = e

View File

@ -19,7 +19,8 @@
"ready": {
"loading": "Vikunja is loading…",
"errorOccured": "An error occured:",
"checkApiUrl": "Please check if the api url is correct below."
"checkApiUrl": "Please check if the api url is correct.",
"noApiUrlConfigured": "No API url was configured. Please set one below:"
},
"user": {
"auth": {