diff --git a/src/app/_services/registry.service.ts b/src/app/_services/registry.service.ts index 8fc8018..47570cf 100644 --- a/src/app/_services/registry.service.ts +++ b/src/app/_services/registry.service.ts @@ -15,7 +15,6 @@ export class RegistryService { constructor() { this.registry.declaratorHelper.addTrust(environment.trustedDeclaratorAddress); - this.registry.load(); } getRegistry(): any { diff --git a/src/app/_services/user.service.ts b/src/app/_services/user.service.ts index 839f7cf..3685197 100644 --- a/src/app/_services/user.service.ts +++ b/src/app/_services/user.service.ts @@ -38,16 +38,21 @@ export class UserService { private loggingService: LoggingService, private tokenService: TokenService, private registryService: RegistryService, - private authService: AuthService, + private authService: AuthService ) { - this.authService.init().then(() => { - this.keystore = authService.mutableKeyStore; - this.signer = new PGPSigner(this.keystore); - }); - this.registry = registryService.getRegistry(); - this.registry.load(); + this.authService = authService; + this.registryService = registryService; } + async load(): Promise { + await this.authService.init(); + // TODO you don't have to do this reassignment + this.keystore = this.authService.mutableKeyStore; + this.signer = new PGPSigner(this.keystore); + this.registry = this.registryService.getRegistry(); + await this.registry.load(); + } + resetPin(phone: string): Observable { const params: HttpParams = new HttpParams().set('phoneNumber', phone); return this.httpClient.get(`${environment.cicUssdUrl}/pin`, {params}); @@ -216,3 +221,5 @@ export class UserService { return this.httpClient.get(`${environment.cicMetaUrl}/genders`); } } + + diff --git a/src/app/pages/accounts/accounts.component.ts b/src/app/pages/accounts/accounts.component.ts index c84e50e..bcb38a2 100644 --- a/src/app/pages/accounts/accounts.component.ts +++ b/src/app/pages/accounts/accounts.component.ts @@ -30,22 +30,15 @@ export class AccountsComponent implements OnInit { constructor( private userService: UserService, - private loggingService: LoggingService, - private router: Router + private router: Router, + private loggingService: LoggingService ) { - (async () => { - try { - // TODO it feels like this should be in the onInit handler - await this.userService.loadAccounts(100); - } catch (error) { - this.loggingService.sendErrorLevelMessage('Failed to load accounts', this, {error}); - } - })(); - this.userService.getAccountTypes().pipe(first()).subscribe(res => this.accountTypes = res); + this.userService = userService; } ngOnInit(): void { + this.userService.getAccountTypes().pipe(first()).subscribe(res => this.accountTypes = res); this.userService.accountsSubject.subscribe(accounts => { this.dataSource = new MatTableDataSource(accounts); this.dataSource.paginator = this.paginator; diff --git a/src/environments/environment.ts b/src/environments/environment.ts index 1b784b6..f13d8e6 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -7,10 +7,10 @@ export const environment = { serverLogLevel: NgxLoggerLevel.OFF, loggingUrl: 'http://localhost:8000', cicMetaUrl: 'https://meta.dev.grassrootseconomics.net', - publicKeysUrl: 'http://localhost:8000/keys.asc', + publicKeysUrl: 'https://dev.grassrootseconomics.net/.well-known/publickeys/', cicCacheUrl: 'https://cache.dev.grassrootseconomics.net', - web3Provider: 'ws://localhost:63546', + web3Provider: 'wss://bloxberg-ws.dev.grassrootseconomics.net', cicUssdUrl: 'https://ussd.dev.grassrootseconomics.net', - registryAddress: '0x6Ca3cB14aA6F761712E1C18646AfBA4d5Ae249E8', + registryAddress: '0xea6225212005e86a4490018ded4bf37f3e772161', trustedDeclaratorAddress: '0xEb3907eCad74a0013c259D5874AE7f22DcBcC95C' };