Commit cb88292e authored by dev0tion's avatar dev0tion

Enable wallet loading

parent d6de1a0f
<h1>Welcome back</h1>
<h1>Welcome to Breeze</h1>
<div *ngIf="hasWallet">
<p>Choose the wallet you want to open:</p>
<div class="form-group">
<label for="walletLabel">Wallet to open:</label>
<select name="wallet" #walletName>
<option *ngFor="let wallet of wallets">{{wallet}}</option>
<select name="wallet" #walletName (change)="walletChanged(walletName.value)">
<option *ngFor="let wallet of wallets" [value]="wallet">{{wallet}}</option>
</select>
</div>
<p>Please enter your password to decrypt your wallet</p>
......@@ -17,5 +17,11 @@
</form>
<p></p>
</div>
<p> If you like to create or restore a wallet please click the button below.</p>
<div *ngIf="hasWallet;else no_wallet">
<p> If you like to create or restore a wallet please click the button below.</p>
</div>
<ng-template #no_wallet>
<p> Looks like you're new here. Please create or restore a wallet.</p>
</ng-template>
<button type="button" (click)="clickedCreate()" class="btn btn-success">Create or restore wallet</button>
\ No newline at end of file
......@@ -13,6 +13,7 @@ export class LoginComponent implements OnInit {
private walletLoad: WalletLoad;
private hasWallet: boolean = false;
private currentWalletName: string;
private wallets: [any];
private walletPath: string;
......@@ -21,6 +22,7 @@ export class LoginComponent implements OnInit {
ngOnInit() {
this.currentWalletName = "";
this.apiService.getWalletFiles()
.subscribe(
response => {
......@@ -28,9 +30,11 @@ export class LoginComponent implements OnInit {
this.responseMessage=response;
this.wallets = response.json().walletsFiles;
this.walletPath = response.json().walletsPath;
console.log(this.wallets);
if (this.wallets.length > 0) {
this.hasWallet = true;
this.currentWalletName = this.wallets[0].slice(0, -5);
} else {
this.hasWallet = false;
}
}
},
......@@ -45,10 +49,13 @@ export class LoginComponent implements OnInit {
}
private onSubmit() {
this.walletLoad = new WalletLoad();
this.walletLoad.password = "test";
this.walletLoad.name = "myFirstWallet"
this.walletLoad.folderPath = "/home/dev0tion/Desktop/Wallets"
this.walletLoad.name = this.currentWalletName;
this.walletLoad.folderPath = this.walletPath;
console.log(this.walletLoad);
this.apiService.loadWallet(this.walletLoad)
.subscribe(
......@@ -69,6 +76,11 @@ export class LoginComponent implements OnInit {
);
}
private walletChanged(walletName: string) {
let walletNameNoJson: string = walletName.slice(0, -5);
this.currentWalletName = walletNameNoJson;
}
private clickedCreate() {
this.router.navigate(['/setup']);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment