[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",
"e2e/tsconfig.json"
],
"exclude": ["**/node_modules/**"]
"exclude": ["**/node_modules/**", "src/app/core/api/**"]
}
},
"e2e": {

View file

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

View file

@ -34,10 +34,9 @@ export class LoginComponent implements OnInit {
email: ['', Validators.required],
password: ['', Validators.required],
});
this.returnUrl =
this.route.snapshot.queryParams['returnUrl'] || '/dashboard';
this.returnUrl = 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', {
duration: 2000,
});

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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