@auth0/angular-jwt
Version:
JSON Web Token helper library for Angular
43 lines (42 loc) • 1.48 kB
JavaScript
import { NgModule, Optional, SkipSelf } from '@angular/core';
import { JwtInterceptor } from './src/jwt.interceptor';
import { JwtHelperService } from './src/jwthelper.service';
import { HTTP_INTERCEPTORS } from '@angular/common/http';
import { JWT_OPTIONS } from './src/jwtoptions.token';
export * from './src/jwt.interceptor';
export * from './src/jwthelper.service';
export * from './src/jwtoptions.token';
var JwtModule = /** @class */ (function () {
function JwtModule(parentModule) {
if (parentModule) {
throw new Error('JwtModule is already loaded. It should only be imported in your application\'s main module.');
}
}
JwtModule.forRoot = function (options) {
return {
ngModule: JwtModule,
providers: [
{
provide: HTTP_INTERCEPTORS,
useClass: JwtInterceptor,
multi: true
},
options.jwtOptionsProvider ||
{
provide: JWT_OPTIONS,
useValue: options.config
},
JwtHelperService
]
};
};
JwtModule.decorators = [
{ type: NgModule },
];
/** @nocollapse */
JwtModule.ctorParameters = function () { return [
{ type: JwtModule, decorators: [{ type: Optional }, { type: SkipSelf },] },
]; };
return JwtModule;
}());
export { JwtModule };