BETTER-AUTH. UI
Queries

useListSessions

List active sessions for the current user.

useListSessions powers account security screens that show active sessions/devices for the signed-in user.

Usage

import { useListSessions } from "@better-auth-ui/solid"

const sessions = useListSessions(authClient)

Options factory and loader helpers

import {
  ensureListSessions,
  fetchListSessions,
  listSessionsOptions,
  prefetchListSessions
} from "@better-auth-ui/solid"

const options = listSessionsOptions(authClient, userId)
await ensureListSessions(queryClient, authClient, userId)
await prefetchListSessions(queryClient, authClient, userId)
const sessions = await fetchListSessions(queryClient, authClient, userId)

Invalidation

import { listSessionsOptions } from "@better-auth-ui/solid"

queryClient.invalidateQueries({
  queryKey: listSessionsOptions(authClient, userId).queryKey
})

Params

Prop

Type

Last updated on

On this page