Skip to content

Commit

Permalink
lint: ajustes manuais de eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
BernardoSemiOficial committed Sep 22, 2024
1 parent 42b127c commit 6ae22e1
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 28 deletions.
18 changes: 3 additions & 15 deletions frontend/src/app/core/guards/auth.guard.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
import { inject } from '@angular/core';
import {
ActivatedRouteSnapshot,
CanActivateChildFn,
CanActivateFn,
Router,
RouterStateSnapshot,
} from '@angular/router';
import { CanActivateChildFn, CanActivateFn, Router } from '@angular/router';
import { AuthService } from '@core/services/auth/auth.service';

export const canActivateAuth: CanActivateFn = (
_: ActivatedRouteSnapshot,
__: RouterStateSnapshot
) => {
export const canActivateAuth: CanActivateFn = () => {
const authService = inject(AuthService);
const router = inject(Router);
const hasAccessToken = authService.getAccessToken();
Expand All @@ -23,10 +14,7 @@ export const canActivateAuth: CanActivateFn = (
return true;
};

export const canActivateChildAuth: CanActivateChildFn = (
_: ActivatedRouteSnapshot,
__: RouterStateSnapshot
) => {
export const canActivateChildAuth: CanActivateChildFn = () => {
const authService = inject(AuthService);
const router = inject(Router);
const hasAccessToken = authService.getAccessToken();
Expand Down
10 changes: 2 additions & 8 deletions frontend/src/app/core/interceptors/authentication.interceptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@ export function authenticationInterceptor(

return next(newReq).pipe(
catchError((error: HttpErrorResponse) => {
const loginOrRefreshOrRegister = requestToLoginOrRefreshToken(
req.url,
authService
);
const loginOrRefreshOrRegister = requestToLoginOrRefreshToken(req.url);
if (loginOrRefreshOrRegister) return throwError(() => error);
if (error instanceof HttpErrorResponse && error.status !== 401)
return throwError(() => error);
Expand Down Expand Up @@ -67,10 +64,7 @@ const retryRequestWithNewAccessToken = (
);
};

const requestToLoginOrRefreshToken = (
url: string,
authService: AuthService
) => {
const requestToLoginOrRefreshToken = (url: string) => {
console.log('requestToLoginOrRefreshToken');
return (
url.includes('refresh-token') ||
Expand Down
3 changes: 1 addition & 2 deletions frontend/src/app/features/login/login.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { HttpErrorResponse } from '@angular/common/http';
import { Component, inject } from '@angular/core';
import { FormBuilder, ReactiveFormsModule, Validators } from '@angular/forms';
import { Router } from '@angular/router';
Expand Down Expand Up @@ -53,7 +52,7 @@ export class LoginComponent {
});
this.router.navigate(['/dashboard']);
},
error: (error: HttpErrorResponse) => {
error: () => {
this.toastAlertService.addDangerMessage({
title: 'Error',
description: 'Invalid credentials',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { InvitationPageComponent } from './invitation-page.component';
describe('InvitationPageComponent', () => {
let component: InvitationPageComponent;
let fixture: ComponentFixture<InvitationPageComponent>;
let userService: UserService;

beforeEach(async () => {
await TestBed.configureTestingModule({
Expand All @@ -29,7 +28,6 @@ describe('InvitationPageComponent', () => {
.compileComponents();

fixture = TestBed.createComponent(InvitationPageComponent);
userService = TestBed.inject(UserService);
component = fixture.componentInstance;
fixture.detectChanges();
});
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/app/shared/app-card/app-card.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class AppCardComponent {
date = input<{ startsAt: Date; endsAt: Date }>();
description = input<string>();
icons = input<{ label: string | number; class: PrimeIcons }[]>([]);
redirectPath = input<any[]>();
redirectPath = input<unknown[]>();
PrimeIcons = PrimeIcons;

handleClickButton() {
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/app/shared/app-header/app-header.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
pRipple
class="flex align-items-center p-menuitem-link"
(click)="logout()"
(keydown.enter)="logout()"
tabindex="0"
>
<span [class]="item.icon"></span>
<span class="ml-2">{{ item.label }}</span>
Expand Down

0 comments on commit 6ae22e1

Please sign in to comment.