[frontend] Fix linter issues

This commit is contained in:
Cathy Hu 2020-09-05 01:30:02 +02:00
parent 0bec1f0bee
commit 3dca6d07ba
10 changed files with 22 additions and 23 deletions

View file

@ -107,7 +107,7 @@
"tsconfig.spec.json", "tsconfig.spec.json",
"e2e/tsconfig.json" "e2e/tsconfig.json"
], ],
"exclude": ["**/node_modules/**"] "exclude": ["**/node_modules/**", "src/app/core/api/**"]
} }
}, },
"e2e": { "e2e": {

View file

@ -16,7 +16,7 @@ export class ConfirmComponent implements OnInit {
) {} ) {}
ngOnInit(): void { ngOnInit(): void {
const token = this.route.snapshot.queryParams['token']; const token = this.route.snapshot.queryParams.token;
if (token) { if (token) {
this.adminService this.adminService
.confirm(token) .confirm(token)

View file

@ -34,10 +34,9 @@ export class LoginComponent implements OnInit {
email: ['', Validators.required], email: ['', Validators.required],
password: ['', Validators.required], password: ['', Validators.required],
}); });
this.returnUrl = this.returnUrl = this.route.snapshot.queryParams.returnUrl || '/dashboard';
this.route.snapshot.queryParams['returnUrl'] || '/dashboard';
if (this.route.snapshot.queryParams['registered'] === true) { if (this.route.snapshot.queryParams.registered === true) {
this.snackBar.open('Registration successful', 'Close', { this.snackBar.open('Registration successful', 'Close', {
duration: 2000, duration: 2000,
}); });

View file

@ -35,7 +35,7 @@ export class RegisterComponent implements OnInit {
password: ['', [Validators.required, Validators.minLength(8)]], password: ['', [Validators.required, Validators.minLength(8)]],
}); });
if (this.route.snapshot.queryParams['error']) { if (this.route.snapshot.queryParams.error) {
this.snackBar.open( this.snackBar.open(
'Invalid confirmation link. Try registering again', 'Invalid confirmation link. Try registering again',
'Close', 'Close',

View file

@ -18,7 +18,7 @@ export class ErrorInterceptor implements HttpInterceptor {
constructor( constructor(
private loginService: LoginService, private loginService: LoginService,
private router: Router, private router: Router,
private _snackBar: MatSnackBar private snackBar: MatSnackBar
) {} ) {}
intercept( intercept(
@ -30,15 +30,15 @@ export class ErrorInterceptor implements HttpInterceptor {
if (err.error instanceof ProgressEvent) { if (err.error instanceof ProgressEvent) {
// TODO Add spinner/overlay in app to prevent user input // TODO Add spinner/overlay in app to prevent user input
console.log('Networkerror'); console.log('Networkerror');
this._snackBar.openFromComponent(OverlayComponent, { this.snackBar.openFromComponent(OverlayComponent, {
verticalPosition: 'top', verticalPosition: 'top',
}); });
setTimeout(function () { setTimeout(() => {
window.location.reload(); window.location.reload();
}, 20000); }, 20000);
} else if (err.status === 401) { } else if (err.status === 401) {
this.loginService.logout(); this.loginService.logout();
location.reload(true); location.reload();
} else if (err.status === 404) { } else if (err.status === 404) {
this.router.navigate(['/404']); this.router.navigate(['/404']);
} }

View file

@ -19,7 +19,7 @@ export class BoardComponent implements OnInit {
) {} ) {}
ngOnInit(): void { ngOnInit(): void {
this.hoodId = this.route.snapshot.params['id']; this.hoodId = this.route.snapshot.params.id;
this.hood$ = this.hoodService.getHood(this.hoodId); this.hood$ = this.hoodService.getHood(this.hoodId);
} }
} }

View file

@ -19,7 +19,7 @@ export class HoodpageComponent implements OnInit {
) {} ) {}
ngOnInit(): void { ngOnInit(): void {
this.hoodId = this.route.snapshot.params['id']; this.hoodId = this.route.snapshot.params.id;
if (this.hoodId) { if (this.hoodId) {
this.hoodsService this.hoodsService
.getHood(this.hoodId) .getHood(this.hoodId)

View file

@ -66,7 +66,7 @@ export class TelegramSettingsComponent implements OnInit {
onEdit(telegramId) { onEdit(telegramId) {
const dialogRef = this.dialog.open(TelegramDialogComponent, { const dialogRef = this.dialog.open(TelegramDialogComponent, {
data: { hoodId: this.hoodId, telegramId: telegramId }, data: { hoodId: this.hoodId, telegramId },
}); });
dialogRef.afterClosed().subscribe(() => { dialogRef.afterClosed().subscribe(() => {

View file

@ -16,28 +16,28 @@ export class TwitterCallbackComponent implements OnInit {
ngOnInit(): void { ngOnInit(): void {
if ( if (
this.route.snapshot.queryParams['hood'] && this.route.snapshot.queryParams.hood &&
this.route.snapshot.queryParams['oauth_token'] && this.route.snapshot.queryParams.oauth_token &&
this.route.snapshot.queryParams['oauth_verifier'] this.route.snapshot.queryParams.oauth_verifier
) { ) {
this.twitterService this.twitterService
.callbackTwitter( .callbackTwitter(
this.route.snapshot.queryParams['oauth_token'], this.route.snapshot.queryParams.oauth_token,
this.route.snapshot.queryParams['oauth_verifier'] this.route.snapshot.queryParams.oauth_verifier
) )
.subscribe(() => { .subscribe(() => {
this.router.navigate([ this.router.navigate([
'/dashboard/hoods', '/dashboard/hoods',
this.route.snapshot.queryParams['hood'], this.route.snapshot.queryParams.hood,
]); ]);
}); });
} else if ( } else if (
this.route.snapshot.queryParams['hood'] && this.route.snapshot.queryParams.hood &&
this.route.snapshot.queryParams['denied'] this.route.snapshot.queryParams.denied
) { ) {
this.router.navigate([ this.router.navigate([
'/dashboard/hoods', '/dashboard/hoods',
this.route.snapshot.queryParams['hood'], this.route.snapshot.queryParams.hood,
]); ]);
} else { } else {
this.router.navigate(['/404']); this.router.navigate(['/404']);

View file

@ -14,7 +14,7 @@ export class ToolbarComponent implements OnInit {
authenticated = false; authenticated = false;
constructor(private loginService: LoginService, private router: Router) { constructor(private loginService: LoginService, private router: Router) {
this.router.routeReuseStrategy.shouldReuseRoute = function () { this.router.routeReuseStrategy.shouldReuseRoute = () => {
return false; return false;
}; };