From f65e27c07ce4053e88c8d0dd2374f39695f059d8 Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 11 Feb 2020 20:05:47 +0900 Subject: [PATCH] Fix #5914 --- src/client/mios.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/client/mios.ts b/src/client/mios.ts index 39719a267..5ab4a53d8 100644 --- a/src/client/mios.ts +++ b/src/client/mios.ts @@ -42,7 +42,16 @@ export default class MiOS extends EventEmitter { * @param callback A function that call when initialized */ @autobind - public async init(callback) { + public async init(_callback) { + const callback = () => { + _callback(); + + this.store.dispatch('instance/fetch').then(() => { + // Init service worker + if (this.store.state.instance.meta.swPublickey) this.registerSw(this.store.state.instance.meta.swPublickey); + }); + }; + this.store = initStore(this); // ユーザーをフェッチしてコールバックする @@ -96,11 +105,6 @@ export default class MiOS extends EventEmitter { // Finish init callback(); - - this.store.dispatch('instance/fetch').then(() => { - // Init service worker - if (this.store.state.instance.meta.swPublickey) this.registerSw(this.store.state.instance.meta.swPublickey); - }); }; // キャッシュがあったとき