Fix bug with much wallet option! #13

Closed
bomb-on wants to merge 1 commits from master into master

@ -121,7 +121,7 @@
"vue-template-compiler": "^2.4.2",
"vuex": "^3.0.1",
"webpack": "^3.5.2",
"webpack-dev-server": ">=3.1.11",
"webpack-dev-server": "^2.11.3",
"webpack-hot-middleware": "^2.18.2"
}
}

@ -70,7 +70,9 @@ export class Config {
}
const name = path.split('/').pop();
this.data.wallets.push({ name, path });
this.save();
if (!this.data.wallets.find(wallet => wallet.name === name && wallet.path === path)) {
this.data.wallets.push({ name, path });
this.save();
}
}
}

@ -22,7 +22,7 @@
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<a v-on:click="openWallet" class="dropdown-item" href="#">Browse</a>
<a v-on:click="openLastWallet" v-for="item in cfg_wallet_names" class="dropdown-item" href="#">{{item}}</a>
<a v-on:click="openLastWallet" v-for="wallet in cfg_wallets" :data-path="wallet.path" class="dropdown-item" href="#">{{wallet.name}}</a>
</div>
</div>
@ -123,8 +123,7 @@
});
},
openLastWallet(event){
const selectedWallet = this.cfg_wallets.find(i => i.name === event.currentTarget.text);
this.$store.commit('addWalletPath', selectedWallet.path);
this.$store.commit('addWalletPath', event.target.dataset.path);
this.$store.commit('showPassword', {
'message': 'Enter wallet password'
});
@ -194,9 +193,6 @@
},
cfg_wallets(){
return this.$store.getters.cfg.wallets;
},
cfg_wallet_names(){
return this.$store.getters.cfg.wallets.map(i => i.name);
}
}
}

@ -67,20 +67,12 @@
this.create_wallet(wallet_name, wallet_pass);
}
},
wallet_exists (name) {
return !!this.wallets.find(i => i.name === name);
},
create_wallet (name, password) {
if (this.wallet_exists(name)) {
console.log('Wallet exists!')
// @TODO check if wallet with same name exists no matter the path
} else {
this.clearMatrixMsg();
this.showMatrixMsg('GENERATING NEW WALLET');
this.clearMatrixMsg();
this.showMatrixMsg('GENERATING NEW WALLET');
this.$store.commit('appState', "create_wallet");
ipcRenderer.send('rpc_create_wallet', {name: name, password: password})
}
this.$store.commit('appState', "create_wallet");
ipcRenderer.send('rpc_create_wallet', {name: name, password: password})
},
showMatrixMsg(msg){
let obj = jQuery('.teh_matrix span.centered');
@ -187,9 +179,6 @@
},
walletCreating(){
return this.$store.state.wallet_creating;
},
wallets() {
return this.$store.getters.cfg.wallets;
}
}
}

@ -95,9 +95,14 @@ export default new Vuex.Store({
state.height_from = data.from;
state.height_to = data.to;
},
addWallet({wallet}, data){
addWallet({cfg, wallet}, data){
if(data.hasOwnProperty('wallet_path')){
wallet.path = data.wallet_path;
const name = data.wallet_path.split('/').pop();
if (!cfg.wallets.find(wallet => wallet.name === name && wallet.path === data.wallet_path)) {
cfg.wallets.push({ name, path: data.wallet_path });
}
}
if(data.hasOwnProperty('txs')){