Merge remote-tracking branch 'origin/bvander/accounts-search-review' into bvander/accounts-search-review

# Conflicts:
#	src/app/_services/user.service.ts
#	src/app/pages/accounts/accounts.component.ts
This commit is contained in:
Spencer Ofwiti 2021-05-09 20:08:39 +03:00
commit c83cc5240e
3 changed files with 13 additions and 4 deletions

View File

@ -15,6 +15,7 @@ export class RegistryService {
constructor() {
this.registry.declaratorHelper.addTrust(environment.trustedDeclaratorAddress);
this.registry.load();
}
async load(): Promise<any> {

View File

@ -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<any> {
async load(): Promise<any> {
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);

View File

@ -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<any>(accounts);