feat: defer everything until the api config is loaded #926

Merged
konrad merged 27 commits from feature/ready-state into main 2021-11-13 19:49:03 +00:00
2 changed files with 4 additions and 2 deletions
Showing only changes of commit 4ca53d77e2 - Show all commits

View File

@ -89,6 +89,7 @@ export default {
async setApiUrl() {
if (this.apiUrl === '') {
// Don't try to check and set an empty url
konrad marked this conversation as resolved Outdated

Explain why we return here

Explain why we return here

Done.

Done.
this.errorMsg = this.$t('apiConfig.urlRequired')
konrad marked this conversation as resolved Outdated

That seems like it should throw an error?

That seems like it should throw an error?

It does yeah. I've modified it so it shows an error with a "good" error message to the user instead of throwing one.

It does yeah. I've modified it so it shows an error with a "good" error message to the user instead of throwing one.
return
}
@ -97,7 +98,7 @@ export default {
konrad marked this conversation as resolved
Review

Explain why we return here

Explain why we return here
if (url === '') {
// If the config setter function could not figure out a url
konrad marked this conversation as resolved Outdated

That seems like it should throw an error? (2)

That seems like it should throw an error? (2)
return
throw new Error('URL cannot be empty.')
}
// Set it + save it to local storage to save us the hoops

View File

@ -787,7 +787,8 @@
"change": "change",
"signInOn": "Sign in to your Vikunja account on {0}",
"error": "Could not find or use Vikunja installation at \"{domain}\". Please try a different url.",
"success": "Using Vikunja installation at \"{domain}\"."
"success": "Using Vikunja installation at \"{domain}\".",
"urlRequired": "A url is required."
},
"loadingError": {
"failed": "Loading failed, please {0}. If the error persists, please {1}.",