UNPKG

fabric8-planner

Version:
31 lines 1.05 kB
import { HttpHeaders } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { AuthenticationService } from 'ngx-login-client'; var AuthInterceptor = /** @class */ (function () { function AuthInterceptor(auth) { this.auth = auth; } AuthInterceptor.prototype.intercept = function (req, next) { if (req.headers.get('planner-req')) { var headers = new HttpHeaders({ 'Authorization': "Bearer " + this.auth.getToken(), 'Content-Type': "application/json" }); var authreq = req.clone({ headers: headers }); return next.handle(authreq); } return next.handle(req); }; AuthInterceptor.decorators = [ { type: Injectable }, ]; /** @nocollapse */ AuthInterceptor.ctorParameters = function () { return [ { type: AuthenticationService, }, ]; }; return AuthInterceptor; }()); export { AuthInterceptor }; //# sourceMappingURL=auth.interceptors.js.map