This package has been deprecated

Author message:

Moved to @vendasta/core

@vendasta/session-service
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

Session Service

This provides a service for other components to use to retrieve session information.

Requirements

The Session Service interface:

export interface SessionServiceInterface {
  getSessionId(): Observable<string>;
}

To implement the interface make a new service that implements the interface:


import {SessionServiceInterface} from '@vendasta/session-service';

@Injectable()
export class SessionService implements SessionServiceInterface {
  
  getSessionId(): Observable<string> {
    // Implement how the project determines the session id
  }
}

Next you will need to provide your service as that interface (generally in app.module.ts)

import { SessionService } from './session.service';
import { SessionServiceInterfaceToken } from '@vendasta/session-service';

@NgModule({
  
  providers: [
    SessionService, {provide: SessionServiceInterfaceToken, useExisting: SessionService}
  ],
})
  • Note: To be able to inject an interface, you will have to provide the InjectionToken and not the interface itself (SessionServiceInterfaceToken vs SessionServiceInterface).

Readme

Keywords

none

Package Sidebar

Install

npm i @vendasta/session-service

Weekly Downloads

0

Version

1.0.2

License

ISC

Last publish

Collaborators

  • vendasta