mirror of
https://github.com/freqtrade/frequi.git
synced 2024-11-27 05:25:17 +00:00
Fix multibot logout
This commit is contained in:
parent
0955c21082
commit
9ad4fefffa
|
@ -3,8 +3,14 @@
|
|||
<h3>Available bots</h3>
|
||||
<div v-for="bot in allAvailableBots" :key="bot">
|
||||
{{ bot }}
|
||||
<b-button class="btn-xs ml-1" size="sm" title="Delete trade" @click="clickRemoveBot(bot)">
|
||||
<EditIcon :size="16" title="Delete trade" />
|
||||
</b-button>
|
||||
<b-button class="btn-xs ml-1" size="sm" title="Delete bot" @click="clickRemoveBot(bot)">
|
||||
<DeleteIcon :size="16" title="Delete trade" />
|
||||
</b-button>
|
||||
</div>
|
||||
<LoginModal login-text="Add new bot" />
|
||||
<LoginModal class="mt-2" login-text="Add new bot" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -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`);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<div>
|
||||
<b-button v-b-modal.modal-prevent-closing>{{ loginText }}</b-button>
|
||||
<b-modal id="modal-prevent-closing" ref="modal" title="Submit Your Name" @ok="handleOk">
|
||||
<b-modal id="modal-prevent-closing" ref="modal" title="Login to your bot" @ok="handleOk">
|
||||
<Login id="loginForm" ref="loginForm" in-modal />
|
||||
</b-modal>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue
Block a user