Refactor auth module.

- Switch from form to text field for passphrase input.
- Refactor error dialog format.
- Send dialog on incorrect parsing of private key.
- Refactor block sync service to take parameters.
This commit is contained in:
Spencer Ofwiti
2021-03-16 13:08:18 +03:00
parent 9fa9852ded
commit 12f4d328bf
15 changed files with 82 additions and 75 deletions

View File

@@ -12,7 +12,6 @@ import {Router} from '@angular/router';
})
export class AuthComponent implements OnInit {
keyForm: FormGroup;
stateForm: FormGroup;
submitted: boolean = false;
loading: boolean = false;
matcher = new CustomErrorStateMatcher();
@@ -27,14 +26,11 @@ export class AuthComponent implements OnInit {
this.keyForm = this.formBuilder.group({
key: ['', Validators.required],
});
this.stateForm = this.formBuilder.group({
state: '',
});
if (this.authService.privateKey !== undefined ) {
this.authService.setKey(this.authService.privateKey).then(r => {
if (this.authService.sessionToken !== undefined) {
this.authService.setState(
'click to perform login ' + this.authService.sessionLoginCount + ' with token ' + this.authService.sessionToken);
'Click button to perform login ' + this.authService.sessionLoginCount + ' with token ' + this.authService.sessionToken);
}
});
}
@@ -54,6 +50,7 @@ export class AuthComponent implements OnInit {
login(): void {
const loginStatus = this.authService.login();
console.log(loginStatus);
if (loginStatus) {
this.router.navigate(['/home']);
}