diff --git a/src/components/BotList.vue b/src/components/BotList.vue index f832b4c2..29f9c3c4 100644 --- a/src/components/BotList.vue +++ b/src/components/BotList.vue @@ -3,8 +3,14 @@

Available bots

{{ bot }} + + + + + +
- + @@ -13,15 +19,24 @@ import { Component, Vue } from 'vue-property-decorator'; import { namespace } from 'vuex-class'; import { MultiBotStoreGetters } from '@/store/modules/botStoreWrapper'; import LoginModal from '@/views/LoginModal.vue'; +import EditIcon from 'vue-material-design-icons/Cog.vue'; +import DeleteIcon from 'vue-material-design-icons/Delete.vue'; const ftbot = namespace('ftbot'); -@Component({ components: { LoginModal } }) +@Component({ components: { LoginModal, DeleteIcon, EditIcon } }) export default class BotList extends Vue { @ftbot.Getter [MultiBotStoreGetters.allAvailableBots]: string[]; - clickAddBot() { + @ftbot.Action removeBot; + + clickRemoveBot(botId) { // + this.$bvModal.msgBoxConfirm(`Really remove (logout) from ${botId}?`).then((value: boolean) => { + if (value) { + this.removeBot(botId); + } + }); } } diff --git a/src/store/modules/botStoreWrapper.ts b/src/store/modules/botStoreWrapper.ts index eee618c5..b83cc109 100644 --- a/src/store/modules/botStoreWrapper.ts +++ b/src/store/modules/botStoreWrapper.ts @@ -75,9 +75,10 @@ export default function createBotStore(store) { store.registerModule(['ftbot', botId], createBotSubStore(botId)); commit('addBot', botId); }, - removeBot({ commit, getters }, botId: string) { + removeBot({ commit, getters, dispatch }, botId: string) { if (getters.allAvailableBots.includes(botId)) { - store.unregisterModule(`ftbot/${botId}`); + dispatch(`${botId}/logout`); + store.unregisterModule([`ftbot`, botId]); commit('removeBot', botId); } else { console.warn(`bot ${botId} not found! could not remove`); diff --git a/src/views/LoginModal.vue b/src/views/LoginModal.vue index f6ed18b4..5e40e982 100644 --- a/src/views/LoginModal.vue +++ b/src/views/LoginModal.vue @@ -1,7 +1,7 @@