Remove specs + eslind on front
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { ActivatedRouteSnapshot, CanActivate, CanActivateChild, Router, RouterStateSnapshot, UrlTree } from '@angular/router';
|
||||
import { CanActivate, Router, UrlTree } from '@angular/router';
|
||||
import { Observable } from 'rxjs';
|
||||
import { AuthService } from './auth.service';
|
||||
|
||||
@@ -11,10 +11,7 @@ export class AuthGuard implements CanActivate {
|
||||
private auth$: AuthService,
|
||||
private router$: Router
|
||||
) {}
|
||||
canActivate(
|
||||
route: ActivatedRouteSnapshot,
|
||||
state: RouterStateSnapshot,
|
||||
): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {
|
||||
canActivate(): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {
|
||||
if (this.auth$.user && this.auth$.user.googleCredentials) {
|
||||
return true;
|
||||
} else {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { HttpClient, HttpErrorResponse, HttpHeaders } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { MatSnackBar } from '@angular/material/snack-bar';
|
||||
import { environment } from 'src/environments/environment';
|
||||
import { User } from '../models/user.model';
|
||||
|
||||
@@ -18,7 +17,7 @@ export class AuthService {
|
||||
|
||||
ping() {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.http$.get<any>(`${environment.api.url}/ping/ping`).subscribe({
|
||||
this.http$.get<string>(`${environment.api.url}/ping/ping`).subscribe({
|
||||
next: (data) => {
|
||||
resolve(data);
|
||||
},
|
||||
@@ -34,6 +33,7 @@ export class AuthService {
|
||||
getAPIToken(credentials: string): Promise<void> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const header = new HttpHeaders().set('Content-type', 'application/json');
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
this.http$.post<any>(`${environment.api.url}/auth/apiToken`, JSON.stringify(credentials), { headers: header }).subscribe({
|
||||
next: (data) => {
|
||||
this.user.id = data.id;
|
||||
|
||||
Reference in New Issue
Block a user