refactor based on review

This commit is contained in:
Blair Vanderlugt 2021-05-08 12:12:33 -07:00
parent 53d6d6b7a4
commit e5fe424185
4 changed files with 21 additions and 22 deletions

View File

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

View File

@ -38,14 +38,19 @@ 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<void> {
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<any> {
@ -216,3 +221,5 @@ export class UserService {
return this.httpClient.get(`${environment.cicMetaUrl}/genders`);
}
}

View File

@ -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<any>(accounts);
this.dataSource.paginator = this.paginator;

View File

@ -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'
};