| 1 |
- {"ast":null,"code":"import * as i0 from \"@angular/core\";\nimport * as i1 from \"src/app/services/auth.service\";\nexport let JwtInterceptor = /*#__PURE__*/(() => {\n class JwtInterceptor {\n constructor(authService) {\n this.authService = authService;\n }\n intercept(request, next) {\n // add auth header with jwt if user is logged in and request is to api url\n const getToken = this.authService.tokenValue;\n const isLoggedIn = getToken && getToken.token;\n if (isLoggedIn) {\n request = request.clone({\n setHeaders: {\n Authorization: `Bearer ${getToken.token}`\n }\n });\n }\n return next.handle(request);\n }\n static #_ = this.ɵfac = function JwtInterceptor_Factory(t) {\n return new (t || JwtInterceptor)(i0.ɵɵinject(i1.AuthService));\n };\n static #_2 = this.ɵprov = /*@__PURE__*/i0.ɵɵdefineInjectable({\n token: JwtInterceptor,\n factory: JwtInterceptor.ɵfac\n });\n }\n return JwtInterceptor;\n})();","map":null,"metadata":{},"sourceType":"module","externalDependencies":[]}
|