A service which handles session management for a front-end application

interface SessionService {
    getLogger(): undefined | Logger;
    getRequestHeaders(options?): Record<string, undefined | null | string | string[]>;
    getSessionState(): SessionState;
    initialize(opts): Promise<boolean>;
    performDelete<T>(url, options?): Promise<T>;
    performGet<T>(url, options?): Promise<T>;
    performPatch<T, U>(url, body, options?): Promise<T>;
    performPost<T, U>(url, body, options?): Promise<T>;
    updateOpts(opts): void;
    updateSessionState(sessionState): void;
}

Implemented by

Methods

  • Return the request headers that would normally be used with an axios request Useful if you need to make a request via a different method and just need the headers

    Parameters

    Returns Record<string, undefined | null | string | string[]>

  • Initializes this service with the given options.

    • Load information from local storage if needed
    • For cookie service, will perform a reauth
    • Sets up fingerprint if not present

    Returns Promise<boolean>

  • Perform a delete request to the specified url Will append any headers or other info needed for auth

    Type Parameters

    • T

    Parameters

    Returns Promise<T>

  • Perform a get request to the specified url Will append any headers or other info needed for auth

    Type Parameters

    • T

    Parameters

    Returns Promise<T>

  • Perform a patch request to the specified url Will append any headers or other info needed for auth

    Type Parameters

    • T

    • U extends object

    Parameters

    Returns Promise<T>

  • Perform a post request to the specified url Will append any headers or other info needed for auth

    Type Parameters

    • T

    • U extends object

    Parameters

    Returns Promise<T>

  • Update the session state with the given data.

    If a userId is provided, the session will be set as logged in (or logged out if null). Call after a successful login or refresh.

    Otherwise, this can be used to update tenantId and other session-based variables

    Parameters

    Returns void

Generated using TypeDoc