From 0467a186493361dd8228417549ef765809f1d1ec Mon Sep 17 00:00:00 2001 From: Matthias Date: Wed, 1 Sep 2021 20:07:38 +0200 Subject: [PATCH] Fix loading of refresh setting --- src/store/modules/botStoreWrapper.ts | 3 ++- src/store/modules/ftbot/index.ts | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/store/modules/botStoreWrapper.ts b/src/store/modules/botStoreWrapper.ts index 97b81a1e..dabb5747 100644 --- a/src/store/modules/botStoreWrapper.ts +++ b/src/store/modules/botStoreWrapper.ts @@ -111,7 +111,7 @@ export default function createBotStore(store) { const actions = { // Actions automatically filled below - addBot({ getters, commit }, bot: BotDescriptor) { + addBot({ dispatch, getters, commit }, bot: BotDescriptor) { if (Object.keys(getters.allAvailableBots).includes(bot.botId)) { // throw 'Bot already present'; // TODO: handle error! @@ -120,6 +120,7 @@ export default function createBotStore(store) { } console.log('add bot', bot); store.registerModule(['ftbot', bot.botId], createBotSubStore(bot.botId)); + dispatch(`${bot.botId}/botAdded`); commit('addBot', bot); }, removeBot({ commit, getters, dispatch }, botId: string) { diff --git a/src/store/modules/ftbot/index.ts b/src/store/modules/ftbot/index.ts index 2b091091..404a217a 100644 --- a/src/store/modules/ftbot/index.ts +++ b/src/store/modules/ftbot/index.ts @@ -93,6 +93,7 @@ export enum BotStoreGetters { } export enum BotStoreActions { + botAdded = 'botAdded', ping = 'ping', setIsBotOnline = 'setIsBotOnline', setAutoRefresh = 'setAutoRefresh', @@ -142,7 +143,6 @@ export function createBotSubStore(botId: string) { const userService = useUserService(botId); const { api } = useApi(userService, botId); - return { namespaced: true, state, @@ -421,6 +421,9 @@ export function createBotSubStore(botId: string) { }, }, actions: { + [BotStoreActions.botAdded]({ commit }) { + commit('setAutoRefresh', userService.getAutoRefresh()); + }, [BotStoreActions.ping]({ commit }) { api .get('/ping')