diff --git a/src/app/_services/registry.service.ts b/src/app/_services/registry.service.ts index 302f467..772c79f 100644 --- a/src/app/_services/registry.service.ts +++ b/src/app/_services/registry.service.ts @@ -15,6 +15,7 @@ export class RegistryService { constructor() { this.registry.declaratorHelper.addTrust(environment.trustedDeclaratorAddress); + this.registry.load(); } async load(): Promise { diff --git a/src/app/_services/user.service.ts b/src/app/_services/user.service.ts index 18feb6f..dd1b9e5 100644 --- a/src/app/_services/user.service.ts +++ b/src/app/_services/user.service.ts @@ -40,15 +40,21 @@ export class UserService { private registryService: RegistryService, private authService: AuthService ) { + //this.authService.init().then(() => { + // this.keystore = authService.mutableKeyStore; + // this.signer = new PGPSigner(this.keystore); + //}); + //this.registry = registryService.getRegistry(); + //this.registry.load(); } - await load(): Observable { + async load(): Promise { try { // TODO this method is called by ngOnInit so we need to // emit an observalbe or conver ngonInit to promise // TODO alig the load/init methods naming await this.authService.init(); - await this.registryService.load(); + // await this.registryService.load(); // TODO key store is defined this.keystore = this.authService.mutableKeyStore; this.signer = new PGPSigner(this.keystore); diff --git a/src/app/pages/accounts/accounts.component.ts b/src/app/pages/accounts/accounts.component.ts index f02c00b..569182c 100644 --- a/src/app/pages/accounts/accounts.component.ts +++ b/src/app/pages/accounts/accounts.component.ts @@ -9,6 +9,8 @@ import {strip0x} from '@src/assets/js/ethtx/dist/hex'; import {first} from 'rxjs/operators'; import {environment} from '@src/environments/environment'; import {AccountDetails} from '@app/_models'; +import {Observable, of} from 'rxjs'; + @Component({ selector: 'app-accounts', @@ -34,11 +36,11 @@ export class AccountsComponent implements OnInit { private loggingService: LoggingService ) { + this.userService = userService; } ngOnInit(): void { - // TODO end of the line you gotta be an observalbe or a promise - this.userService.load(); + of(this.userService.load()) this.userService.getAccountTypes().pipe(first()).subscribe(res => this.accountTypes = res); this.userService.accountsSubject.subscribe(accounts => { this.dataSource = new MatTableDataSource(accounts);