Fixed API caching not triggered when loading app for first time
This commit is contained in:
parent
bf4c1290d7
commit
9b98e8773d
|
@ -114,7 +114,7 @@ export default {
|
||||||
let defaultInstanceUrl = this.$store.state.instance.frontSettings.defaultServerUrl || process.env.VUE_APP_INSTANCE_URL || this.$store.getters['instance/defaultUrl']()
|
let defaultInstanceUrl = this.$store.state.instance.frontSettings.defaultServerUrl || process.env.VUE_APP_INSTANCE_URL || this.$store.getters['instance/defaultUrl']()
|
||||||
this.$store.commit('instance/instanceUrl', defaultInstanceUrl)
|
this.$store.commit('instance/instanceUrl', defaultInstanceUrl)
|
||||||
} else {
|
} else {
|
||||||
// needed to trigger initialization of axios
|
// needed to trigger initialization of axios / service worker
|
||||||
this.$store.commit('instance/instanceUrl', this.$store.state.instance.instanceUrl)
|
this.$store.commit('instance/instanceUrl', this.$store.state.instance.instanceUrl)
|
||||||
}
|
}
|
||||||
await this.fetchNodeInfo()
|
await this.fetchNodeInfo()
|
||||||
|
@ -320,13 +320,6 @@ export default {
|
||||||
'$store.state.instance.instanceUrl' (v) {
|
'$store.state.instance.instanceUrl' (v) {
|
||||||
this.$store.dispatch('instance/fetchSettings')
|
this.$store.dispatch('instance/fetchSettings')
|
||||||
this.fetchNodeInfo()
|
this.fetchNodeInfo()
|
||||||
if (this.serviceWorker.registration) {
|
|
||||||
let sw = this.serviceWorker.registration.active
|
|
||||||
if (sw) {
|
|
||||||
sw.postMessage({command: 'serverChosen', serverUrl: v})
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
'$store.state.ui.theme': {
|
'$store.state.ui.theme': {
|
||||||
immediate: true,
|
immediate: true,
|
||||||
|
|
|
@ -9,6 +9,12 @@ function getDefaultUrl () {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function notifyServiceWorker (registration, message) {
|
||||||
|
if (registration && registration.active) {
|
||||||
|
registration.active.postMessage(message)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
namespaced: true,
|
namespaced: true,
|
||||||
state: {
|
state: {
|
||||||
|
@ -75,7 +81,7 @@ export default {
|
||||||
value = value + '/'
|
value = value + '/'
|
||||||
}
|
}
|
||||||
state.instanceUrl = value
|
state.instanceUrl = value
|
||||||
|
notifyServiceWorker(state.registration, {command: 'serverChosen', serverUrl: state.instanceUrl})
|
||||||
// append the URL to the list (and remove existing one if needed)
|
// append the URL to the list (and remove existing one if needed)
|
||||||
if (value) {
|
if (value) {
|
||||||
let index = state.knownInstances.indexOf(value);
|
let index = state.knownInstances.indexOf(value);
|
||||||
|
|
Loading…
Reference in New Issue