Clean up stale variables and lint code.

This commit is contained in:
Spencer Ofwiti 2021-06-30 15:24:40 +03:00
parent e1bb7355e3
commit 62e2486417
11 changed files with 12 additions and 54 deletions

View File

@ -14,7 +14,7 @@ import { Observable, throwError } from 'rxjs';
import { catchError } from 'rxjs/operators'; import { catchError } from 'rxjs/operators';
// Application imports // Application imports
import { ErrorDialogService, LoggingService } from '@app/_services'; import { LoggingService } from '@app/_services';
/** Intercepts and handles errors from outgoing HTTP request. */ /** Intercepts and handles errors from outgoing HTTP request. */
@Injectable() @Injectable()
@ -22,15 +22,10 @@ export class ErrorInterceptor implements HttpInterceptor {
/** /**
* Initialization of the error interceptor. * Initialization of the error interceptor.
* *
* @param errorDialogService - A service that provides a dialog box for displaying errors to the user.
* @param loggingService - A service that provides logging capabilities. * @param loggingService - A service that provides logging capabilities.
* @param router - A service that provides navigation among views and URL manipulation capabilities. * @param router - A service that provides navigation among views and URL manipulation capabilities.
*/ */
constructor( constructor(private loggingService: LoggingService, private router: Router) {}
private errorDialogService: ErrorDialogService,
private loggingService: LoggingService,
private router: Router
) {}
/** /**
* Intercepts HTTP requests. * Intercepts HTTP requests.

View File

@ -5,7 +5,6 @@ import { environment } from '@src/environments/environment';
import { LoggingService } from '@app/_services/logging.service'; import { LoggingService } from '@app/_services/logging.service';
import { MutableKeyStore } from '@app/_pgp'; import { MutableKeyStore } from '@app/_pgp';
import { ErrorDialogService } from '@app/_services/error-dialog.service'; import { ErrorDialogService } from '@app/_services/error-dialog.service';
import { HttpClient } from '@angular/common/http';
import { HttpError, rejectBody } from '@app/_helpers/global-error-handler'; import { HttpError, rejectBody } from '@app/_helpers/global-error-handler';
import { Staff } from '@app/_models'; import { Staff } from '@app/_models';
import { BehaviorSubject, Observable } from 'rxjs'; import { BehaviorSubject, Observable } from 'rxjs';
@ -23,7 +22,6 @@ export class AuthService {
trustedUsersSubject: Observable<Array<Staff>> = this.trustedUsersList.asObservable(); trustedUsersSubject: Observable<Array<Staff>> = this.trustedUsersList.asObservable();
constructor( constructor(
private httpClient: HttpClient,
private loggingService: LoggingService, private loggingService: LoggingService,
private errorDialogService: ErrorDialogService private errorDialogService: ErrorDialogService
) {} ) {}

View File

@ -14,9 +14,7 @@ export class BlockSyncService {
readyStateTarget: number = 2; readyStateTarget: number = 2;
readyState: number = 0; readyState: number = 0;
constructor( constructor(private transactionService: TransactionService) {}
private transactionService: TransactionService,
) {}
async blockSync(address: string = null, offset: number = 0, limit: number = 100): Promise<void> { async blockSync(address: string = null, offset: number = 0, limit: number = 100): Promise<void> {
this.transactionService.resetTransactionsList(); this.transactionService.resetTransactionsList();

View File

@ -5,9 +5,6 @@ import { NGXLogger } from 'ngx-logger';
providedIn: 'root', providedIn: 'root',
}) })
export class LoggingService { export class LoggingService {
env: string;
canDebug: boolean;
constructor(private logger: NGXLogger) { constructor(private logger: NGXLogger) {
// TRACE|DEBUG|INFO|LOG|WARN|ERROR|FATAL|OFF // TRACE|DEBUG|INFO|LOG|WARN|ERROR|FATAL|OFF
if (isDevMode()) { if (isDevMode()) {

View File

@ -22,9 +22,7 @@ export class TokenService {
async init(): Promise<void> { async init(): Promise<void> {
this.registry = await RegistryService.getRegistry(); this.registry = await RegistryService.getRegistry();
this.tokenRegistry = new TokenRegistry( this.tokenRegistry = await RegistryService.getTokenRegistry();
await this.registry.getContractAddressByName('TokenRegistry')
);
this.load.next(true); this.load.next(true);
} }

View File

@ -10,7 +10,6 @@ import { add0x, fromHex, strip0x, toHex } from '@src/assets/js/ethtx/dist/hex';
import { Tx } from '@src/assets/js/ethtx/dist'; import { Tx } from '@src/assets/js/ethtx/dist';
import { toValue } from '@src/assets/js/ethtx/dist/tx'; import { toValue } from '@src/assets/js/ethtx/dist/tx';
import * as secp256k1 from 'secp256k1'; import * as secp256k1 from 'secp256k1';
import { AuthService } from '@app/_services/auth.service';
import { defaultAccount } from '@app/_models'; import { defaultAccount } from '@app/_models';
import { LoggingService } from '@app/_services/logging.service'; import { LoggingService } from '@app/_services/logging.service';
import { HttpClient } from '@angular/common/http'; import { HttpClient } from '@angular/common/http';
@ -28,13 +27,11 @@ export class TransactionService {
transactions: any[] = []; transactions: any[] = [];
private transactionList = new BehaviorSubject<any[]>(this.transactions); private transactionList = new BehaviorSubject<any[]>(this.transactions);
transactionsSubject = this.transactionList.asObservable(); transactionsSubject = this.transactionList.asObservable();
userInfo: any;
web3: Web3; web3: Web3;
registry: CICRegistry; registry: CICRegistry;
constructor( constructor(
private httpClient: HttpClient, private httpClient: HttpClient,
private authService: AuthService,
private userService: UserService, private userService: UserService,
private loggingService: LoggingService private loggingService: LoggingService
) { ) {

View File

@ -41,7 +41,7 @@ export class UserService {
constructor( constructor(
private httpClient: HttpClient, private httpClient: HttpClient,
private loggingService: LoggingService, private loggingService: LoggingService,
private tokenService: TokenService, private tokenService: TokenService
) {} ) {}
async init(): Promise<void> { async init(): Promise<void> {
@ -261,10 +261,6 @@ export class UserService {
this.accountsList.next(this.accounts); this.accountsList.next(this.accounts);
} }
searchAccountByName(name: string): any {
return;
}
getCategories(): void { getCategories(): void {
this.httpClient this.httpClient
.get(`${environment.cicMetaUrl}/categories`) .get(`${environment.cicMetaUrl}/categories`)

View File

@ -1,9 +1,12 @@
import { ChangeDetectionStrategy, Component, HostListener, OnInit } from '@angular/core'; import { ChangeDetectionStrategy, Component, HostListener, OnInit } from '@angular/core';
import { import {
AuthService, BlockSyncService, AuthService,
BlockSyncService,
ErrorDialogService, ErrorDialogService,
LoggingService, TokenService, LoggingService,
TransactionService, UserService, TokenService,
TransactionService,
UserService,
} from '@app/_services'; } from '@app/_services';
import { SwUpdate } from '@angular/service-worker'; import { SwUpdate } from '@angular/service-worker';
@ -15,8 +18,6 @@ import { SwUpdate } from '@angular/service-worker';
}) })
export class AppComponent implements OnInit { export class AppComponent implements OnInit {
title = 'CICADA'; title = 'CICADA';
readyStateTarget: number = 3;
readyState: number = 0;
mediaQuery: MediaQueryList = window.matchMedia('(max-width: 768px)'); mediaQuery: MediaQueryList = window.matchMedia('(max-width: 768px)');
constructor( constructor(

View File

@ -13,9 +13,6 @@ import { environment } from '@src/environments/environment';
changeDetection: ChangeDetectionStrategy.OnPush, changeDetection: ChangeDetectionStrategy.OnPush,
}) })
export class AccountSearchComponent implements OnInit { export class AccountSearchComponent implements OnInit {
nameSearchForm: FormGroup;
nameSearchSubmitted: boolean = false;
nameSearchLoading: boolean = false;
phoneSearchForm: FormGroup; phoneSearchForm: FormGroup;
phoneSearchSubmitted: boolean = false; phoneSearchSubmitted: boolean = false;
phoneSearchLoading: boolean = false; phoneSearchLoading: boolean = false;
@ -29,9 +26,6 @@ export class AccountSearchComponent implements OnInit {
private userService: UserService, private userService: UserService,
private router: Router private router: Router
) { ) {
this.nameSearchForm = this.formBuilder.group({
name: ['', Validators.required],
});
this.phoneSearchForm = this.formBuilder.group({ this.phoneSearchForm = this.formBuilder.group({
phoneNumber: ['', Validators.required], phoneNumber: ['', Validators.required],
}); });
@ -42,9 +36,6 @@ export class AccountSearchComponent implements OnInit {
ngOnInit(): void {} ngOnInit(): void {}
get nameSearchFormStub(): any {
return this.nameSearchForm.controls;
}
get phoneSearchFormStub(): any { get phoneSearchFormStub(): any {
return this.phoneSearchForm.controls; return this.phoneSearchForm.controls;
} }
@ -52,16 +43,6 @@ export class AccountSearchComponent implements OnInit {
return this.addressSearchForm.controls; 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> { async onPhoneSearch(): Promise<void> {
this.phoneSearchSubmitted = true; this.phoneSearchSubmitted = true;
if (this.phoneSearchForm.invalid) { if (this.phoneSearchForm.invalid) {

View File

@ -13,7 +13,6 @@ import { exportCsv } from '@app/_helpers';
changeDetection: ChangeDetectionStrategy.OnPush, changeDetection: ChangeDetectionStrategy.OnPush,
}) })
export class SettingsComponent implements OnInit { export class SettingsComponent implements OnInit {
date: string;
dataSource: MatTableDataSource<any>; dataSource: MatTableDataSource<any>;
displayedColumns: Array<string> = ['name', 'email', 'userId']; displayedColumns: Array<string> = ['name', 'email', 'userId'];
trustedUsers: Array<Staff>; trustedUsers: Array<Staff>;

View File

@ -20,9 +20,7 @@ export class TokensComponent implements OnInit {
tokens: Array<Token>; tokens: Array<Token>;
token: Token; token: Token;
constructor( constructor(private tokenService: TokenService) {}
private tokenService: TokenService,
) {}
ngOnInit(): void { ngOnInit(): void {
this.tokenService.load.subscribe(async (status: boolean) => { this.tokenService.load.subscribe(async (status: boolean) => {