Lime Web Components API Documentation - v6.24.0
    Preparing search index...

    Function SelectSession

    • Decorator that subscribes to the application session from the ApplicationRepository.

      This decorator automatically updates the decorated property whenever the session changes in the platform. The session contains authentication and authorization information. It's the recommended approach over manual subscriptions as it handles subscription lifecycle automatically.

      Parameters

      Returns PropertyDecorator

      A PropertyDecorator that sets up automatic subscription to the session

      Subscribes to: ApplicationRepository

      Updates: The decorated property with the Session object

      Lifecycle: Automatically subscribes in connectedCallback and unsubscribes in disconnectedCallback of the component.

      @State()
      @SelectSession()
      private session: Session;
      // Extract specific session property
      @State()
      @SelectSession({
      map: [(session) => session?.admin]
      })
      private isAdmin: boolean;
      // Filter for valid sessions only
      @State()
      @SelectSession({
      filter: [(session) => session !== null && session?.active === true]
      })
      private activeSession: Session;