@daveyplate/better-auth-tanstack
Version:
Tanstack hooks for better-auth
18 lines (15 loc) • 500 B
text/typescript
import type { AnyUseQueryOptions } from "@tanstack/react-query"
import type { AuthClient } from "../../types/auth-client"
import { useAuthQuery } from "../shared/use-auth-query"
export function useListOrganizations<TAuthClient extends AuthClient>(
authClient: TAuthClient,
options?: Partial<AnyUseQueryOptions>
) {
const queryKey = ["organizations"]
return useAuthQuery({
authClient,
queryKey,
queryFn: authClient.organization.list,
options
})
}