Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import { ModuleWithProviders, NgModule } from '@angular/core';
import { KeepaliveSvc, NgIdleModule } from '@ng-idle/core';
import { Keepalive } from './keepalive';
@NgModule({ imports: [NgIdleModule.forRoot()] })
export class NgIdleKeepaliveModule {
static forRoot(): ModuleWithProviders {
return {
ngModule: NgIdleKeepaliveModule,
providers: [Keepalive, { provide: KeepaliveSvc, useExisting: Keepalive }]
};
}
}
import { UIRouterModule } from "@uirouter/angular";
import { NgIdleModule } from "@ng-idle/core";
import { NgIdleKeepaliveModule } from "@ng-idle/keepalive";
import { from } from "rxjs";
import { starkSessionReducers } from "./reducers";
import { STARK_SESSION_CONFIG, StarkSessionConfig } from "./entities";
import { STARK_SESSION_SERVICE, StarkSessionServiceImpl } from "./services";
import { STARK_ROUTING_SERVICE, StarkRoutingService } from "../routing/services";
import { SESSION_STATES } from "./routes";
import { starkLoginStateName, starkPreloadingStateName } from "./constants";
import { StarkAppContainerComponent } from "./components";
@NgModule({
imports: [
CommonModule,
NgIdleModule.forRoot(),
NgIdleKeepaliveModule.forRoot(),
StoreModule.forFeature("StarkSession", starkSessionReducers),
UIRouterModule.forChild({
states: SESSION_STATES
})
],
declarations: [StarkAppContainerComponent],
exports: [StarkAppContainerComponent]
})
export class StarkSessionModule {
/**
* Instantiates the services only once since they should be singletons
* so the forRoot() should be called only by the AppModule
* @link https://angular.io/guide/singleton-services#forroot
* @param sessionConfig - Object containing the configuration (if any) for the Session service
* @returns a module with providers