UNPKG

@asi-ngtools/lib

Version:

This project is a little components library, simple to use, which will help you to simplify your project.

37 lines (36 loc) 1.26 kB
import { HttpInterceptor, HttpRequest, HttpHandler, HttpEvent } from '@angular/common/http'; import { Observable } from 'rxjs'; export declare abstract class AsiRefreshTokenInceptor implements HttpInterceptor { private static readonly UNAUTHORIZED; private refreshingToken; private loginUrl; private refreshTokenUrl; private refreshTokenSubject; constructor(); intercept(req: HttpRequest<any>, next: HttpHandler): Observable<any>; onRequestSuccess(_event: HttpEvent<any>): void; /** * Add auth token to the request header * @param req the request * @param replay is the token replayed */ abstract addAuthenticationToken(req: HttpRequest<any>, replay: boolean): HttpRequest<any>; /** * Get the refresh token endpoint url */ abstract getRefreshTokenUrl(): string; /** * Call the refresh token endpoint and save the new token */ abstract callAndSaveRefreshToken(): Observable<any>; /** * Get the login endpoint url */ abstract getLoginUrl(): string; /** * Change the current page to the login page * @param req the request * @param err the err */ abstract goToLoginPage(req: HttpRequest<any>, err: any): void; }