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