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';
// Application imports
import { ErrorDialogService, LoggingService } from '@app/_services';
import { LoggingService } from '@app/_services';
/** Intercepts and handles errors from outgoing HTTP request. */
@Injectable()
@ -22,15 +22,10 @@ export class ErrorInterceptor implements HttpInterceptor {
/**
* 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 router - A service that provides navigation among views and URL manipulation capabilities.
*/
constructor(
private errorDialogService: ErrorDialogService,
private loggingService: LoggingService,
private router: Router
) {}
constructor(private loggingService: LoggingService, private router: Router) {}
/**
* Intercepts HTTP requests.

View File

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

View File

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

View File

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

View File

@ -22,9 +22,7 @@ export class TokenService {
async init(): Promise<void> {
this.registry = await RegistryService.getRegistry();
this.tokenRegistry = new TokenRegistry(
await this.registry.getContractAddressByName('TokenRegistry')
);
this.tokenRegistry = await RegistryService.getTokenRegistry();
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 { toValue } from '@src/assets/js/ethtx/dist/tx';
import * as secp256k1 from 'secp256k1';
import { AuthService } from '@app/_services/auth.service';
import { defaultAccount } from '@app/_models';
import { LoggingService } from '@app/_services/logging.service';
import { HttpClient } from '@angular/common/http';
@ -28,13 +27,11 @@ export class TransactionService {
transactions: any[] = [];
private transactionList = new BehaviorSubject<any[]>(this.transactions);
transactionsSubject = this.transactionList.asObservable();
userInfo: any;
web3: Web3;
registry: CICRegistry;
constructor(
private httpClient: HttpClient,
private authService: AuthService,
private userService: UserService,
private loggingService: LoggingService
) {

View File

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

View File

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

View File

@ -13,9 +13,6 @@ 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;
@ -29,9 +26,6 @@ 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],
});
@ -42,9 +36,6 @@ export class AccountSearchComponent implements OnInit {
ngOnInit(): void {}
get nameSearchFormStub(): any {
return this.nameSearchForm.controls;
}
get phoneSearchFormStub(): any {
return this.phoneSearchForm.controls;
}
@ -52,16 +43,6 @@ 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) {

View File

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

View File

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