refactor based on review
This commit is contained in:
parent
53d6d6b7a4
commit
e5fe424185
@ -15,7 +15,6 @@ export class RegistryService {
|
|||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.registry.declaratorHelper.addTrust(environment.trustedDeclaratorAddress);
|
this.registry.declaratorHelper.addTrust(environment.trustedDeclaratorAddress);
|
||||||
this.registry.load();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getRegistry(): any {
|
getRegistry(): any {
|
||||||
|
@ -38,16 +38,21 @@ export class UserService {
|
|||||||
private loggingService: LoggingService,
|
private loggingService: LoggingService,
|
||||||
private tokenService: TokenService,
|
private tokenService: TokenService,
|
||||||
private registryService: RegistryService,
|
private registryService: RegistryService,
|
||||||
private authService: AuthService,
|
private authService: AuthService
|
||||||
) {
|
) {
|
||||||
this.authService.init().then(() => {
|
this.authService = authService;
|
||||||
this.keystore = authService.mutableKeyStore;
|
this.registryService = registryService;
|
||||||
this.signer = new PGPSigner(this.keystore);
|
|
||||||
});
|
|
||||||
this.registry = registryService.getRegistry();
|
|
||||||
this.registry.load();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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> {
|
resetPin(phone: string): Observable<any> {
|
||||||
const params: HttpParams = new HttpParams().set('phoneNumber', phone);
|
const params: HttpParams = new HttpParams().set('phoneNumber', phone);
|
||||||
return this.httpClient.get(`${environment.cicUssdUrl}/pin`, {params});
|
return this.httpClient.get(`${environment.cicUssdUrl}/pin`, {params});
|
||||||
@ -216,3 +221,5 @@ export class UserService {
|
|||||||
return this.httpClient.get(`${environment.cicMetaUrl}/genders`);
|
return this.httpClient.get(`${environment.cicMetaUrl}/genders`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -30,22 +30,15 @@ export class AccountsComponent implements OnInit {
|
|||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private userService: UserService,
|
private userService: UserService,
|
||||||
private loggingService: LoggingService,
|
private router: Router,
|
||||||
private router: Router
|
private loggingService: LoggingService
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
(async () => {
|
this.userService = userService;
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
|
this.userService.getAccountTypes().pipe(first()).subscribe(res => this.accountTypes = res);
|
||||||
this.userService.accountsSubject.subscribe(accounts => {
|
this.userService.accountsSubject.subscribe(accounts => {
|
||||||
this.dataSource = new MatTableDataSource<any>(accounts);
|
this.dataSource = new MatTableDataSource<any>(accounts);
|
||||||
this.dataSource.paginator = this.paginator;
|
this.dataSource.paginator = this.paginator;
|
||||||
|
@ -7,10 +7,10 @@ export const environment = {
|
|||||||
serverLogLevel: NgxLoggerLevel.OFF,
|
serverLogLevel: NgxLoggerLevel.OFF,
|
||||||
loggingUrl: 'http://localhost:8000',
|
loggingUrl: 'http://localhost:8000',
|
||||||
cicMetaUrl: 'https://meta.dev.grassrootseconomics.net',
|
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',
|
cicCacheUrl: 'https://cache.dev.grassrootseconomics.net',
|
||||||
web3Provider: 'ws://localhost:63546',
|
web3Provider: 'wss://bloxberg-ws.dev.grassrootseconomics.net',
|
||||||
cicUssdUrl: 'https://ussd.dev.grassrootseconomics.net',
|
cicUssdUrl: 'https://ussd.dev.grassrootseconomics.net',
|
||||||
registryAddress: '0x6Ca3cB14aA6F761712E1C18646AfBA4d5Ae249E8',
|
registryAddress: '0xea6225212005e86a4490018ded4bf37f3e772161',
|
||||||
trustedDeclaratorAddress: '0xEb3907eCad74a0013c259D5874AE7f22DcBcC95C'
|
trustedDeclaratorAddress: '0xEb3907eCad74a0013c259D5874AE7f22DcBcC95C'
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user