fix(editor): Fix settings initialisation (#6750)

Signed-off-by: Oleg Ivaniv <me@olegivaniv.com>
This commit is contained in:
OlegIvaniv 2023-07-27 08:53:12 +02:00 committed by GitHub
parent d30bd7e501
commit 27d995066b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -101,13 +101,18 @@ export default defineComponent({
data() { data() {
return { return {
postAuthenticateDone: false, postAuthenticateDone: false,
settingsInitialised: false,
loading: true, loading: true,
}; };
}, },
methods: { methods: {
async initSettings(): Promise<void> { async initSettings(): Promise<void> {
// The settings should only be initialized once
if (this.settingsInitialised) return;
try { try {
await this.settingsStore.getSettings(); await this.settingsStore.getSettings();
this.settingsInitialised = true;
} catch (e) { } catch (e) {
this.showToast({ this.showToast({
title: this.$locale.baseText('startupError'), title: this.$locale.baseText('startupError'),
@ -139,7 +144,6 @@ export default defineComponent({
} }
}, },
async initialize(): Promise<void> { async initialize(): Promise<void> {
await this.initSettings();
await Promise.all([this.loginWithCookie(), this.initTemplates()]); await Promise.all([this.loginWithCookie(), this.initTemplates()]);
}, },
trackPage(): void { trackPage(): void {
@ -279,7 +283,8 @@ export default defineComponent({
void this.postAuthenticate(); void this.postAuthenticate();
} }
}, },
$route(route) { async $route(route) {
await this.initSettings();
this.authenticate(); this.authenticate();
this.redirectIfNecessary(); this.redirectIfNecessary();