File

src/app/_interceptors/http-config.interceptor.ts

Index

Methods

Constructor

constructor()

Methods

intercept
intercept(request: HttpRequest, next: HttpHandler)
Parameters :
Name Type Optional
request HttpRequest<unknown> No
next HttpHandler No
Returns : Observable<HttpEvent<unknown>>
import { Injectable } from '@angular/core';
import { HttpRequest, HttpHandler, HttpEvent, HttpInterceptor } from '@angular/common/http';
import { Observable } from 'rxjs';

@Injectable()
export class HttpConfigInterceptor implements HttpInterceptor {
  constructor() {}

  intercept(request: HttpRequest<unknown>, next: HttpHandler): Observable<HttpEvent<unknown>> {
    // const token: string = sessionStorage.getItem(btoa('CICADA_SESSION_TOKEN'));

    // if (token) {
    //   request = request.clone({headers: request.headers.set('Authorization', 'Bearer ' + token)});
    // }

    return next.handle(request);
  }
}

result-matching ""

    No results matching ""