• 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.

    Returns

    A PropertyDecorator that sets up automatic subscription to the session

    Remarks

    Subscribes to: ApplicationRepository

    Updates: The decorated property with the Session object

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

    Example

    @State()
    @SelectSession()
    private session: Session;

    Example

    // Extract specific session property
    @State()
    @SelectSession({
    map: [(session) => session?.admin]
    })
    private isAdmin: boolean;

    Example

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

    Parameters

    Returns PropertyDecorator