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']()
|
||||
this.$store.commit('instance/instanceUrl', defaultInstanceUrl)
|
||||
} 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)
|
||||
}
|
||||
await this.fetchNodeInfo()
|
||||
|
@ -320,13 +320,6 @@ export default {
|
|||
'$store.state.instance.instanceUrl' (v) {
|
||||
this.$store.dispatch('instance/fetchSettings')
|
||||
this.fetchNodeInfo()
|
||||
if (this.serviceWorker.registration) {
|
||||
let sw = this.serviceWorker.registration.active
|
||||
if (sw) {
|
||||
sw.postMessage({command: 'serverChosen', serverUrl: v})
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
'$store.state.ui.theme': {
|
||||
immediate: true,
|
||||
|
|
|
@ -9,6 +9,12 @@ function getDefaultUrl () {
|
|||
)
|
||||
}
|
||||
|
||||
function notifyServiceWorker (registration, message) {
|
||||
if (registration && registration.active) {
|
||||
registration.active.postMessage(message)
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
|
@ -75,7 +81,7 @@ export default {
|
|||
value = value + '/'
|
||||
}
|
||||
state.instanceUrl = value
|
||||
|
||||
notifyServiceWorker(state.registration, {command: 'serverChosen', serverUrl: state.instanceUrl})
|
||||
// append the URL to the list (and remove existing one if needed)
|
||||
if (value) {
|
||||
let index = state.knownInstances.indexOf(value);
|
||||
|
|
Loading…
Reference in New Issue