diff --git a/src/components/home/contentNoAuth.vue b/src/components/home/contentNoAuth.vue index b95739067..f6b473c35 100644 --- a/src/components/home/contentNoAuth.vue +++ b/src/components/home/contentNoAuth.vue @@ -1,40 +1,20 @@ - - \ No newline at end of file diff --git a/src/components/misc/api-config.vue b/src/components/misc/api-config.vue index 8e3e1606d..f37e08491 100644 --- a/src/components/misc/api-config.vue +++ b/src/components/misc/api-config.vue @@ -70,30 +70,45 @@ export default { return parseURL(this.apiUrl).host }, }, + props: { + configureOpen: { + type: Boolean, + required: false, + default: false, + }, + }, + watch: { + configureOpen: { + handler(value) { + this.configureApi = value + }, + immediate: true, + }, + }, methods: { - setApiUrl() { + async setApiUrl() { if (this.apiUrl === '') { return } - checkAndSetApiUrl(this.apiUrl, () => this.$store.dispatch('config/update')) - .catch(() => { - // Still not found, url is still invalid - this.successMsg = '' - this.errorMsg = this.$t('apiConfig.error', {domain: this.apiDomain}) - }) - .then(url => { - if (url === '') { - return - } + try { + const url = await checkAndSetApiUrl(this.apiUrl, () => this.$store.dispatch('config/update')) - // Set it + save it to local storage to save us the hoops - this.errorMsg = '' - this.successMsg = this.$t('apiConfig.success', {domain: this.apiDomain}) - this.configureApi = false - this.apiUrl = url - this.$emit('foundApi', this.apiUrl) - }) + if (url === '') { + return + } + + // Set it + save it to local storage to save us the hoops + this.errorMsg = '' + this.successMsg = this.$t('apiConfig.success', {domain: this.apiDomain}) + this.configureApi = false + this.apiUrl = url + this.$emit('foundApi', this.apiUrl) + } catch (e) { + // Still not found, url is still invalid + this.successMsg = '' + this.errorMsg = this.$t('apiConfig.error', {domain: this.apiDomain}) + } }, }, } diff --git a/src/components/misc/no-auth-wrapper.vue b/src/components/misc/no-auth-wrapper.vue new file mode 100644 index 000000000..4fefb7f25 --- /dev/null +++ b/src/components/misc/no-auth-wrapper.vue @@ -0,0 +1,47 @@ + + + + + diff --git a/src/components/misc/ready.vue b/src/components/misc/ready.vue index f31f5421b..06f76903d 100644 --- a/src/components/misc/ready.vue +++ b/src/components/misc/ready.vue @@ -3,23 +3,41 @@
- {{ error }} + + +
+

+ {{ $t('ready.errorOccured') }}
+ {{ error }} +

+

+ {{ $t('ready.checkApiUrl') }} +

+
+ +
+
Vikunja

- {{ $t('home.vikunjaLoading') }} + {{ $t('ready.loading') }}

diff --git a/src/i18n/lang/en.json b/src/i18n/lang/en.json index 79886d36b..acc4e2fae 100644 --- a/src/i18n/lang/en.json +++ b/src/i18n/lang/en.json @@ -1,6 +1,5 @@ { "home": { - "vikunjaLoading": "Vikunja is loading…", "welcomeNight": "Good Night {username}", "welcomeMorning": "Good Morning {username}", "welcomeDay": "Hi {username}", @@ -17,6 +16,11 @@ "title": "Not found", "text": "The page you requested does not exist." }, + "ready": { + "loading": "Vikunja is loading…", + "errorOccured": "An error occured:", + "checkApiUrl": "Please check if the api url is correct below." + }, "user": { "auth": { "username": "Username", @@ -777,7 +781,7 @@ "urlPlaceholder": "eg. https://localhost:3456", "change": "change", "signInOn": "Sign in to your Vikunja account on {0}", - "error": "Could not find or use Vikunja installation at \"{domain}\".", + "error": "Could not find or use Vikunja installation at \"{domain}\". Please try a different url.", "success": "Using Vikunja installation at \"{domain}\"." }, "loadingError": {