Fix #490: Ensure we always have a default api url set on first load to avoid displaying the instance picker

This commit is contained in:
Eliot Berriot 2018-08-21 18:22:57 +02:00
parent 14774f393c
commit 5e7985387e
No known key found for this signature in database
GPG Key ID: DD6965E2476E5C27
4 changed files with 9 additions and 7 deletions

View File

@ -28,7 +28,7 @@ review_front:
- yarn run i18n-compile - yarn run i18n-compile
# this is to ensure we don't have any errors in the output, # this is to ensure we don't have any errors in the output,
# cf https://code.eliotberriot.com/funkwhale/funkwhale/issues/169 # cf https://code.eliotberriot.com/funkwhale/funkwhale/issues/169
- INSTANCE_URL=$REVIEW_INSTANCE_URL yarn run build | tee /dev/stderr | (! grep -i 'ERROR in') - VUE_APP_INSTANCE_URL=$REVIEW_INSTANCE_URL yarn run build | tee /dev/stderr | (! grep -i 'ERROR in')
- mkdir -p /static/front/$CI_PROJECT_PATH_SLUG-$CI_BUILD_REF_SLUG - mkdir -p /static/front/$CI_PROJECT_PATH_SLUG-$CI_BUILD_REF_SLUG
- cp -r dist/* /static/front/$CI_PROJECT_PATH_SLUG-$CI_BUILD_REF_SLUG - cp -r dist/* /static/front/$CI_PROJECT_PATH_SLUG-$CI_BUILD_REF_SLUG
cache: cache:

View File

@ -0,0 +1 @@
Ensure we always have a default api url set on first load to avoid displaying the instance picker (#490)

View File

@ -124,12 +124,13 @@ export default {
// used to redraw ago dates every minute // used to redraw ago dates every minute
self.$store.commit('ui/computeLastDate') self.$store.commit('ui/computeLastDate')
}, 1000 * 60) }, 1000 * 60)
if (this.$store.state.instance.instanceUrl) { if (!this.$store.state.instance.instanceUrl) {
this.$store.commit('instance/instanceUrl', this.$store.state.instance.instanceUrl) let defaultInstanceUrl = process.env.VUE_APP_INSTANCE_URL || this.$store.getters['instance/defaultUrl']()
this.$store.dispatch('auth/check') this.$store.commit('instance/instanceUrl', defaultInstanceUrl)
this.$store.dispatch('instance/fetchSettings')
this.fetchNodeInfo()
} }
this.$store.dispatch('auth/check')
this.$store.dispatch('instance/fetchSettings')
this.fetchNodeInfo()
}, },
methods: { methods: {
fetchNodeInfo () { fetchNodeInfo () {

View File

@ -14,7 +14,7 @@ export default {
state: { state: {
maxEvents: 200, maxEvents: 200,
frontSettings: {}, frontSettings: {},
instanceUrl: process.env.INSTANCE_URL, instanceUrl: process.env.VUE_APP_INSTANCE_URL,
events: [], events: [],
settings: { settings: {
instance: { instance: {