This version (v0.7) has not been published to npm yet.
Skip to content

Reference / @getenginex/sdk-vue / useSession

useSession() ​

useSession(): Readonly<ShallowRef<Session>>

Current player session, reactive to login, logout and a renewal that changes the identity. Subscribes to client.session and undoes the subscription when the component's (or effectScope's) scope ends. On the server (SSR) it returns the snapshot of the moment, without subscribing.

Returns ​

Readonly<ShallowRef<Session>>

Read-only ref with the Session of the EnginexPlugin's client.

Throws ​

If called in an app without the EnginexPlugin.

Example ​

ts
const session = useSession()
const isLoggedIn = computed(() => session.value.status === 'authenticated')