diff --git a/docs/compodoc/classes/AccountIndex.html b/docs/compodoc/classes/AccountIndex.html index 469854d..9808103 100644 --- a/docs/compodoc/classes/AccountIndex.html +++ b/docs/compodoc/classes/AccountIndex.html @@ -357,8 +357,8 @@ Allows querying of accounts that have been registered as valid accounts in the n -
Defined in src/app/_eth/accountIndex.ts:61
+
Defined in src/app/_eth/accountIndex.ts:58
@@ -450,8 +450,8 @@ Requires availability of the signer address.

-
Defined in src/app/_eth/accountIndex.ts:82
+
Defined in src/app/_eth/accountIndex.ts:79
@@ -543,8 +543,8 @@ Returns "true" for available and "false" otherwise.

-
Defined in src/app/_eth/accountIndex.ts:99
+
Defined in src/app/_eth/accountIndex.ts:96
@@ -635,8 +635,8 @@ Returns "true" for available and "false" otherwise.

-
Defined in src/app/_eth/accountIndex.ts:125
+
Defined in src/app/_eth/accountIndex.ts:122
@@ -714,9 +714,6 @@ export class AccountIndex { constructor(contractAddress: string, signerAddress?: string) { this.contractAddress = contractAddress; this.contract = new web3.eth.Contract(abi, this.contractAddress); - // TODO this signer logic should be part of the web3service - // if signer address is not passed (for example in user service) then - // this fallsback to a web3 wallet that is not even connected??? if (signerAddress) { this.signerAddress = signerAddress; } else { diff --git a/docs/compodoc/components/AccountDetailsComponent.html b/docs/compodoc/components/AccountDetailsComponent.html index 13f4b32..afa072d 100644 --- a/docs/compodoc/components/AccountDetailsComponent.html +++ b/docs/compodoc/components/AccountDetailsComponent.html @@ -71,7 +71,6 @@

OnInit - AfterViewInit

@@ -266,9 +265,6 @@
  • filterTransactions
  • -
  • - ngAfterViewInit -
  • Async ngOnInit @@ -323,7 +319,7 @@ -
    Defined in src/app/pages/accounts/account-details/account-details.component.ts:71
    +
    Defined in src/app/pages/accounts/account-details/account-details.component.ts:70
    @@ -512,8 +508,8 @@ -
    Defined in src/app/pages/accounts/account-details/account-details.component.ts:295
    +
    Defined in src/app/pages/accounts/account-details/account-details.component.ts:287
    @@ -551,8 +547,8 @@ -
    Defined in src/app/pages/accounts/account-details/account-details.component.ts:210
    +
    Defined in src/app/pages/accounts/account-details/account-details.component.ts:202
    @@ -621,8 +617,8 @@ -
    Defined in src/app/pages/accounts/account-details/account-details.component.ts:214
    +
    Defined in src/app/pages/accounts/account-details/account-details.component.ts:206
    @@ -691,8 +687,8 @@ -
    Defined in src/app/pages/accounts/account-details/account-details.component.ts:291
    +
    Defined in src/app/pages/accounts/account-details/account-details.component.ts:283
    @@ -773,8 +769,8 @@ -
    Defined in src/app/pages/accounts/account-details/account-details.component.ts:253
    +
    Defined in src/app/pages/accounts/account-details/account-details.component.ts:245
    @@ -812,47 +808,8 @@ -
    Defined in src/app/pages/accounts/account-details/account-details.component.ts:266
    - - - - - - - -
    - Returns : void - -
    - - - - - - - - - - - - - - - - @@ -892,8 +849,8 @@ @@ -931,8 +888,8 @@ @@ -972,8 +929,8 @@ @@ -1011,8 +968,8 @@ @@ -1077,8 +1034,8 @@ @@ -1147,7 +1104,7 @@ @@ -1174,7 +1131,7 @@ @@ -1201,7 +1158,7 @@ @@ -1233,7 +1190,7 @@ @@ -1260,7 +1217,7 @@ @@ -1292,7 +1249,7 @@ @@ -1319,7 +1276,7 @@ @@ -1346,7 +1303,7 @@ @@ -1373,7 +1330,7 @@ @@ -1400,7 +1357,7 @@ @@ -1427,7 +1384,7 @@ @@ -1454,7 +1411,7 @@ @@ -1481,7 +1438,7 @@ @@ -1508,7 +1465,7 @@ @@ -1535,7 +1492,7 @@ @@ -1567,7 +1524,7 @@ @@ -1599,7 +1556,7 @@ @@ -1626,7 +1583,7 @@ @@ -1653,7 +1610,7 @@ @@ -1680,7 +1637,7 @@ @@ -1707,7 +1664,7 @@ @@ -1739,7 +1696,7 @@ @@ -1771,7 +1728,7 @@ @@ -1803,7 +1760,7 @@ @@ -1835,7 +1792,7 @@ @@ -1862,7 +1819,7 @@ @@ -1898,7 +1855,7 @@ @@ -1934,7 +1891,7 @@ @@ -1961,7 +1918,7 @@ @@ -1993,7 +1950,7 @@ @@ -2025,7 +1982,7 @@ @@ -2057,7 +2014,7 @@ @@ -2093,7 +2050,7 @@ @@ -2129,7 +2086,7 @@ @@ -2158,7 +2115,7 @@ @@ -2170,7 +2127,6 @@
    import {
    -  AfterViewInit,
       ChangeDetectionStrategy,
       ChangeDetectorRef,
       Component,
    @@ -2203,7 +2159,7 @@ import { AccountDetails, Transaction } from '@app/_models';
       styleUrls: ['./account-details.component.scss'],
       changeDetection: ChangeDetectionStrategy.OnPush,
     })
    -export class AccountDetailsComponent implements OnInit, AfterViewInit {
    +export class AccountDetailsComponent implements OnInit {
       transactionsDataSource: MatTableDataSource<any>;
       transactionsDisplayedColumns: Array<string> = ['sender', 'recipient', 'value', 'created', 'type'];
       transactionsDefaultPageSize: number = 10;
    @@ -2275,7 +2231,10 @@ export class AccountDetailsComponent implements OnInit, AfterViewInit {
           location: ['', Validators.required],
           locationType: ['', Validators.required],
         });
    -    this.transactionService.resetTransactionsList();
    +    await this.blockSyncService.init();
    +    await this.tokenService.init();
    +    await this.transactionService.init();
    +    await this.userService.init();
         await this.blockSyncService.blockSync(this.accountAddress);
         this.userService.resetAccountsList();
         (await this.userService.getAccountByAddress(this.accountAddress, 100)).subscribe(
    @@ -2283,6 +2242,7 @@ export class AccountDetailsComponent implements OnInit, AfterViewInit {
             if (res !== undefined) {
               this.account = res;
               this.cdr.detectChanges();
    +          this.loggingService.sendInfoLevelMessage(this.account);
               this.locationService.areaNamesSubject.subscribe((response) => {
                 this.area = this.locationService.getAreaNameByLocation(
                   this.account.location.area_name,
    @@ -2367,17 +2327,6 @@ export class AccountDetailsComponent implements OnInit, AfterViewInit {
         });
       }
     
    -  ngAfterViewInit(): void {
    -    if (this.userDataSource) {
    -      this.userDataSource.paginator = this.userTablePaginator;
    -      this.userDataSource.sort = this.userTableSort;
    -    }
    -    if (this.transactionsDataSource) {
    -      this.transactionsDataSource.paginator = this.transactionTablePaginator;
    -      this.transactionsDataSource.sort = this.transactionTableSort;
    -    }
    -  }
    -
       doTransactionFilter(value: string): void {
         this.transactionsDataSource.filter = value.trim().toLocaleLowerCase();
       }
    diff --git a/docs/compodoc/components/AccountSearchComponent.html b/docs/compodoc/components/AccountSearchComponent.html
    index 0bfd5d6..9ded5a7 100644
    --- a/docs/compodoc/components/AccountSearchComponent.html
    +++ b/docs/compodoc/components/AccountSearchComponent.html
    @@ -145,6 +145,15 @@
                                 
  • matcher
  • +
  • + nameSearchForm +
  • +
  • + nameSearchLoading +
  • +
  • + nameSearchSubmitted +
  • phoneSearchForm
  • @@ -167,12 +176,16 @@
    @@ -295,6 +311,7 @@ + Async ngOnInit @@ -303,15 +320,16 @@ @@ -320,7 +338,7 @@ @@ -351,8 +369,8 @@ @@ -368,6 +386,45 @@
    - - - - ngAfterViewInit - - - -
    -ngAfterViewInit() -
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    -ngOnInit() + + ngOnInit()
    - +
    - Returns : void + Returns : Promise<void>
    - +
    + + + + + + + + + + + + + + + + + + + +
    + + + + onNameSearch + + + +
    +onNameSearch() +
    + +
    + +
    + Returns : void + +
    +
    @@ -392,8 +449,8 @@ @@ -435,7 +492,7 @@ @@ -467,7 +524,7 @@ @@ -499,7 +556,7 @@ @@ -531,7 +588,98 @@ + + + + +
    - +
    - +
    - +
    - +
    - + +
    + + + + + + + + + + + + + + +
    + + + + nameSearchForm + + +
    + Type : FormGroup + +
    + +
    + + + + + + + + + + + + + + + + + +
    + + + + nameSearchLoading + + +
    + Type : boolean + +
    + Default value : false +
    + +
    + + + + + + + + + + + + + @@ -558,7 +706,7 @@ @@ -590,7 +738,7 @@ @@ -622,7 +770,7 @@ @@ -635,6 +783,28 @@

    Accessors

    +
    + + + + nameSearchSubmitted + + +
    + Type : boolean + +
    + Default value : false +
    +
    - +
    - +
    - +
    + + + + + + + + + + + + + +
    + + nameSearchFormStub +
    + getnameSearchFormStub() +
    + +
    @@ -651,7 +821,7 @@ @@ -673,7 +843,7 @@ @@ -699,6 +869,9 @@ import { environment } from '@src/environments/environment'; changeDetection: ChangeDetectionStrategy.OnPush, }) export class AccountSearchComponent implements OnInit { + nameSearchForm: FormGroup; + nameSearchSubmitted: boolean = false; + nameSearchLoading: boolean = false; phoneSearchForm: FormGroup; phoneSearchSubmitted: boolean = false; phoneSearchLoading: boolean = false; @@ -712,6 +885,9 @@ export class AccountSearchComponent implements OnInit { private userService: UserService, private router: Router ) { + this.nameSearchForm = this.formBuilder.group({ + name: ['', Validators.required], + }); this.phoneSearchForm = this.formBuilder.group({ phoneNumber: ['', Validators.required], }); @@ -720,8 +896,13 @@ export class AccountSearchComponent implements OnInit { }); } - ngOnInit(): void {} + async ngOnInit(): Promise<void> { + await this.userService.init(); + } + get nameSearchFormStub(): any { + return this.nameSearchForm.controls; + } get phoneSearchFormStub(): any { return this.phoneSearchForm.controls; } @@ -729,6 +910,16 @@ export class AccountSearchComponent implements OnInit { return this.addressSearchForm.controls; } + onNameSearch(): void { + this.nameSearchSubmitted = true; + if (this.nameSearchForm.invalid) { + return; + } + this.nameSearchLoading = true; + this.userService.searchAccountByName(this.nameSearchFormStub.name.value); + this.nameSearchLoading = false; + } + async onPhoneSearch(): Promise<void> { this.phoneSearchSubmitted = true; if (this.phoneSearchForm.invalid) { diff --git a/docs/compodoc/components/AccountsComponent.html b/docs/compodoc/components/AccountsComponent.html index f161130..008ae3b 100644 --- a/docs/compodoc/components/AccountsComponent.html +++ b/docs/compodoc/components/AccountsComponent.html @@ -71,7 +71,6 @@

    OnInit - AfterViewInit

    @@ -185,9 +184,6 @@
  • filterAccounts
  • -
  • - ngAfterViewInit -
  • Async ngOnInit @@ -217,12 +213,12 @@
  • @@ -240,10 +236,10 @@ - + - + @@ -397,8 +393,8 @@ @@ -436,47 +432,8 @@ - - - - - - - -
    - +
    - +
    -constructor(loggingService: LoggingService, userService: UserService, router: Router, tokenService: TokenService) +constructor(userService: UserService, loggingService: LoggingService, router: Router, tokenService: TokenService)
    - +
    loggingServiceuserService - LoggingService + UserService @@ -252,10 +248,10 @@
    userServiceloggingService - UserService + LoggingService @@ -327,8 +323,8 @@
    - +
    - +
    - -
    - -
    - Returns : void - -
    -
    - - - - - - - - - - - - @@ -516,8 +473,8 @@ @@ -555,8 +512,8 @@ @@ -596,8 +553,8 @@ @@ -671,7 +628,7 @@ @@ -703,7 +660,7 @@ @@ -730,7 +687,7 @@ @@ -757,7 +714,7 @@ @@ -789,7 +746,7 @@ @@ -821,7 +778,7 @@ @@ -853,7 +810,7 @@ @@ -889,7 +846,7 @@ @@ -925,7 +882,7 @@ @@ -952,7 +909,7 @@ @@ -965,13 +922,7 @@
    -
    import {
    -  AfterViewInit,
    -  ChangeDetectionStrategy,
    -  Component,
    -  OnInit,
    -  ViewChild,
    -} from '@angular/core';
    +        
    import { ChangeDetectionStrategy, Component, OnInit, ViewChild } from '@angular/core';
     import { MatTableDataSource } from '@angular/material/table';
     import { MatPaginator } from '@angular/material/paginator';
     import { MatSort } from '@angular/material/sort';
    @@ -989,7 +940,7 @@ import { AccountDetails } from '@app/_models';
       styleUrls: ['./accounts.component.scss'],
       changeDetection: ChangeDetectionStrategy.OnPush,
     })
    -export class AccountsComponent implements OnInit, AfterViewInit {
    +export class AccountsComponent implements OnInit {
       dataSource: MatTableDataSource<any>;
       accounts: Array<AccountDetails> = [];
       displayedColumns: Array<string> = ['name', 'phone', 'created', 'balance', 'location'];
    @@ -1003,25 +954,27 @@ export class AccountsComponent implements OnInit, AfterViewInit {
       @ViewChild(MatSort) sort: MatSort;
     
       constructor(
    -    private loggingService: LoggingService,
         private userService: UserService,
    +    private loggingService: LoggingService,
         private router: Router,
         private tokenService: TokenService
       ) {}
     
       async ngOnInit(): Promise<void> {
    -    this.userService.accountsSubject.subscribe((accounts) => {
    -      this.dataSource = new MatTableDataSource<any>(accounts);
    -      this.dataSource.paginator = this.paginator;
    -      this.dataSource.sort = this.sort;
    -      this.accounts = accounts;
    -    });
    +    await this.userService.init();
    +    await this.tokenService.init();
         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.accountsSubject.subscribe((accounts) => {
    +      this.dataSource = new MatTableDataSource<any>(accounts);
    +      this.dataSource.paginator = this.paginator;
    +      this.dataSource.sort = this.sort;
    +      this.accounts = accounts;
    +    });
         this.userService
           .getAccountTypes()
           .pipe(first())
    @@ -1033,13 +986,6 @@ export class AccountsComponent implements OnInit, AfterViewInit {
         });
       }
     
    -  ngAfterViewInit(): void {
    -    if (this.dataSource) {
    -      this.dataSource.paginator = this.paginator;
    -      this.dataSource.sort = this.sort;
    -    }
    -  }
    -
       doFilter(value: string): void {
         this.dataSource.filter = value.trim().toLocaleLowerCase();
       }
    diff --git a/docs/compodoc/components/AdminComponent.html b/docs/compodoc/components/AdminComponent.html
    index 3e83dac..c25efbb 100644
    --- a/docs/compodoc/components/AdminComponent.html
    +++ b/docs/compodoc/components/AdminComponent.html
    @@ -182,6 +182,7 @@
                                     expandCollapse
                                 
                                 
  • + Async ngOnInit
  • @@ -288,8 +289,8 @@
    @@ -358,8 +359,8 @@ @@ -428,8 +429,8 @@ @@ -498,8 +499,8 @@ @@ -568,8 +569,8 @@ @@ -607,8 +608,8 @@ @@ -658,6 +659,7 @@ + Async ngOnInit @@ -666,7 +668,8 @@ @@ -683,7 +686,7 @@ @@ -895,7 +898,7 @@ import { LoggingService, UserService } from '@app/_services'; import { animate, state, style, transition, trigger } from '@angular/animations'; import { first } from 'rxjs/operators'; import { exportCsv } from '@app/_helpers'; -import { Action } from '@app/_models'; +import { Action } from '../../_models'; @Component({ selector: 'app-admin', @@ -921,7 +924,8 @@ export class AdminComponent implements OnInit { constructor(private userService: UserService, private loggingService: LoggingService) {} - ngOnInit(): void { + async ngOnInit(): Promise<void> { + await this.userService.init(); this.userService.getActions(); this.userService.actionsSubject.subscribe((actions) => { this.dataSource = new MatTableDataSource<any>(actions); diff --git a/docs/compodoc/components/AppComponent.html b/docs/compodoc/components/AppComponent.html index f1c97ef..7aeaf1b 100644 --- a/docs/compodoc/components/AppComponent.html +++ b/docs/compodoc/components/AppComponent.html @@ -133,17 +133,17 @@ @@ -199,12 +199,12 @@ @@ -234,22 +234,10 @@ - + - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - ngAfterViewInit - - - -
    -ngAfterViewInit() -
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    -ngOnInit() + + ngOnInit()
    - Returns : void + Returns : Promise<void>
    -constructor(authService: AuthService, blockSyncService: BlockSyncService, errorDialogService: ErrorDialogService, loggingService: LoggingService, tokenService: TokenService, transactionService: TransactionService, userService: UserService, swUpdate: SwUpdate, router: Router) +constructor(authService: AuthService, transactionService: TransactionService, loggingService: LoggingService, errorDialogService: ErrorDialogService, swUpdate: SwUpdate)
    - +
    blockSyncServicetransactionService - BlockSyncService - - No -
    errorDialogService - ErrorDialogService + TransactionService @@ -270,34 +258,10 @@
    tokenServiceerrorDialogService - TokenService - - No -
    transactionService - TransactionService - - No -
    userService - UserService + ErrorDialogService @@ -317,18 +281,6 @@
    router - Router - - No -
    @@ -369,8 +321,8 @@ - + @@ -404,8 +356,8 @@ - + @@ -442,8 +394,8 @@ - + @@ -481,8 +433,8 @@ - + @@ -531,38 +483,6 @@

    Properties

    - - - - - - - - - - - - - - - - - -
    - - - - accountDetailsRegex - - -
    - Type : string - -
    - Default value : '/accounts/[a-z,A-Z,0-9]{40}' -
    - -
    @@ -588,7 +508,71 @@ + + + + +
    - + +
    + + + + + + + + + + + + + + + + + +
    + + + + readyState + + +
    + Type : number + +
    + Default value : 0 +
    + +
    + + + + + + + + + + + + + @@ -620,34 +604,7 @@ - - - - -
    + + + + readyStateTarget + + +
    + Type : number + +
    + Default value : 3 +
    +
    - -
    - - - - - - - - - - @@ -663,16 +620,12 @@
    import { ChangeDetectionStrategy, Component, HostListener, OnInit } from '@angular/core';
     import {
       AuthService,
    -  BlockSyncService,
       ErrorDialogService,
       LoggingService,
    -  TokenService,
       TransactionService,
    -  UserService,
     } from '@app/_services';
    +import { catchError } from 'rxjs/operators';
     import { SwUpdate } from '@angular/service-worker';
    -import { NavigationEnd, Router } from '@angular/router';
    -import { filter } from 'rxjs/operators';
     
     @Component({
       selector: 'app-root',
    @@ -682,20 +635,16 @@ import { filter } from 'rxjs/operators';
     })
     export class AppComponent implements OnInit {
       title = 'CICADA';
    +  readyStateTarget: number = 3;
    +  readyState: number = 0;
       mediaQuery: MediaQueryList = window.matchMedia('(max-width: 768px)');
    -  url: string;
    -  accountDetailsRegex = '/accounts/[a-z,A-Z,0-9]{40}';
     
       constructor(
         private authService: AuthService,
    -    private blockSyncService: BlockSyncService,
    -    private errorDialogService: ErrorDialogService,
    -    private loggingService: LoggingService,
    -    private tokenService: TokenService,
         private transactionService: TransactionService,
    -    private userService: UserService,
    -    private swUpdate: SwUpdate,
    -    private router: Router
    +    private loggingService: LoggingService,
    +    private errorDialogService: ErrorDialogService,
    +    private swUpdate: SwUpdate
       ) {
         this.mediaQuery.addEventListener('change', this.onResize);
         this.onResize(this.mediaQuery);
    @@ -703,27 +652,7 @@ export class AppComponent implements OnInit {
     
       async ngOnInit(): Promise<void> {
         await this.authService.init();
    -    await this.tokenService.init();
    -    await this.userService.init();
         await this.transactionService.init();
    -    await this.router.events
    -      .pipe(filter((e) => e instanceof NavigationEnd))
    -      .forEach(async (routeInfo) => {
    -        if (routeInfo instanceof NavigationEnd) {
    -          this.url = routeInfo.url;
    -          if (!this.url.match(this.accountDetailsRegex) || !this.url.includes('tx')) {
    -            await this.blockSyncService.blockSync();
    -          }
    -          if (!this.url.includes('accounts')) {
    -            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 });
    -            }
    -          }
    -        }
    -      });
         try {
           const publicKeys = await this.authService.getPublicKeys();
           await this.authService.mutableKeyStore.importPublicKey(publicKeys);
    @@ -734,11 +663,6 @@ export class AppComponent implements OnInit {
           });
           // TODO do something to halt user progress...show a sad cicada page 🦗?
         }
    -    this.tokenService.load.subscribe(async (status: boolean) => {
    -      if (status) {
    -        await this.tokenService.getTokens();
    -      }
    -    });
         if (!this.swUpdate.isEnabled) {
           this.swUpdate.available.subscribe(() => {
             if (confirm('New Version available. Load New Version?')) {
    diff --git a/docs/compodoc/components/AuthComponent.html b/docs/compodoc/components/AuthComponent.html
    index d15420f..bce0b2b 100644
    --- a/docs/compodoc/components/AuthComponent.html
    +++ b/docs/compodoc/components/AuthComponent.html
    @@ -162,6 +162,7 @@
                                     login
                                 
                                 
  • + Async ngOnInit
  • @@ -211,7 +212,7 @@
  • @@ -318,8 +319,8 @@ @@ -342,6 +343,7 @@ + Async ngOnInit @@ -350,15 +352,16 @@ @@ -367,7 +370,7 @@ @@ -398,8 +401,8 @@ @@ -437,8 +440,8 @@ @@ -476,8 +479,8 @@ @@ -550,7 +553,7 @@ @@ -582,7 +585,7 @@ @@ -614,7 +617,7 @@ @@ -646,7 +649,7 @@ @@ -675,7 +678,7 @@ @@ -691,6 +694,7 @@ import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { CustomErrorStateMatcher } from '@app/_helpers'; import { AuthService } from '@app/_services'; import { ErrorDialogService } from '@app/_services/error-dialog.service'; +import { LoggingService } from '@app/_services/logging.service'; import { Router } from '@angular/router'; @Component({ @@ -712,7 +716,7 @@ export class AuthComponent implements OnInit { private errorDialogService: ErrorDialogService ) {} - ngOnInit(): void { + async ngOnInit(): Promise<void> { this.keyForm = this.formBuilder.group({ key: ['', Validators.required], }); @@ -745,7 +749,7 @@ export class AuthComponent implements OnInit { } } catch (HttpError) { this.errorDialogService.openDialog({ - message: 'Failed to login please try again.', + message: HttpError.message, }); } } diff --git a/docs/compodoc/components/CreateAccountComponent.html b/docs/compodoc/components/CreateAccountComponent.html index 469b171..21cfc33 100644 --- a/docs/compodoc/components/CreateAccountComponent.html +++ b/docs/compodoc/components/CreateAccountComponent.html @@ -167,6 +167,7 @@ @@ -312,7 +315,7 @@ @@ -341,8 +344,8 @@ @@ -585,7 +588,7 @@ @@ -623,7 +626,8 @@ export class CreateAccountComponent implements OnInit { private userService: UserService ) {} - ngOnInit(): void { + async ngOnInit(): Promise<void> { + await this.userService.init(); this.createForm = this.formBuilder.group({ accountType: ['', Validators.required], idNumber: ['', Validators.required], diff --git a/docs/compodoc/components/NetworkStatusComponent.html b/docs/compodoc/components/NetworkStatusComponent.html index fbb9985..c977b9d 100644 --- a/docs/compodoc/components/NetworkStatusComponent.html +++ b/docs/compodoc/components/NetworkStatusComponent.html @@ -134,7 +134,7 @@ @@ -177,7 +177,7 @@ @@ -246,8 +246,8 @@ @@ -285,8 +285,8 @@ @@ -312,11 +312,11 @@ @@ -328,12 +328,12 @@ @@ -347,7 +347,6 @@
    import { Component, OnInit, ChangeDetectionStrategy, ChangeDetectorRef } from '@angular/core';
    -import { checkOnlineStatus } from '@src/app/_helpers';
     
     @Component({
       selector: 'app-network-status',
    @@ -356,31 +355,22 @@ import { checkOnlineStatus } from '@src/app/_helpers';
       changeDetection: ChangeDetectionStrategy.OnPush,
     })
     export class NetworkStatusComponent implements OnInit {
    -  online: boolean = navigator.onLine;
    +  noInternetConnection: boolean = !navigator.onLine;
     
       constructor(private cdr: ChangeDetectorRef) {
         this.handleNetworkChange();
       }
     
    -  ngOnInit(): void {
    -    window.addEventListener('online', (event: any) => {
    -      this.online = true;
    -      this.cdr.detectChanges();
    -    });
    -    window.addEventListener('offline', (event: any) => {
    -      this.online = false;
    -      this.cdr.detectChanges();
    -    });
    -  }
    +  ngOnInit(): void {}
     
       handleNetworkChange(): void {
    -    setTimeout(async () => {
    -      if (this.online !== (await checkOnlineStatus())) {
    -        this.online = await checkOnlineStatus();
    +    setTimeout(() => {
    +      if (!navigator.onLine !== this.noInternetConnection) {
    +        this.noInternetConnection = !navigator.onLine;
             this.cdr.detectChanges();
           }
           this.handleNetworkChange();
    -    }, 3000);
    +    }, 5000);
       }
     }
     
    @@ -389,7 +379,7 @@ export class NetworkStatusComponent implements OnInit {
    <nav class="navbar navbar-dark background-dark">
       <h1 class="navbar-brand">
    -    <div *ngIf="online; then onlineBlock; else offlineBlock"></div>
    +    <div *ngIf="noInternetConnection; then offlineBlock; else onlineBlock"></div>
         <ng-template #offlineBlock>
           <strong style="color: red">OFFLINE </strong>
           <img width="20rem" src="assets/images/no-wifi.svg" alt="Internet Disconnected" />
    @@ -435,7 +425,7 @@ export class NetworkStatusComponent implements OnInit {
     
     
     
    - - - - url - - -
    - Type : string - -
    - +
    - +
    - +
    -ngOnInit() + + ngOnInit()
    - +
    - Returns : void + Returns : Promise<void>
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    • + Async ngOnInit
    • @@ -287,6 +288,7 @@ + Async ngOnInit @@ -295,7 +297,8 @@
    -ngOnInit() + + ngOnInit()
    - Returns : void + Returns : Promise<void>
    - +
    - +
    - +
    - +
    - +
    - + - online - + noInternetConnection +
    - Default value : navigator.onLine + Default value : !navigator.onLine
    - +