Skip to main content

Overview

useCheckMyMembership returns a callable function that checks the authenticated user’s membership in a specific space without loading the full space object. A user with a membership gets it back whatever its status (a banned user learns they’re banned); a user with no membership in a space they can’t see gets 404 space/not-found. It calls GET /spaces/:spaceId/members/me. Your own membership is always …/members/me: this hook reads it and useLeaveSpace leaves it. The member hooks that take a userId (useUpdateMemberRole, useApproveMember, useDeclineMember, useBanMember, useUnbanMember) act on other members and refuse your own id.

Usage Example

Parameters

string
required
UUID of the space to check membership for.

Returns

boolean
Whether the user has an active membership.
"admin" | "moderator" | "member" | undefined
The user’s role. Present only when isMember is true.
"pending" | "active" | "banned" | "rejected" | undefined
The user’s membership status. Present only when a membership record exists, whatever its status.
string | undefined
ISO timestamp of when the membership was created. Present only when isMember is true.
object
Resolved permissions: canPost, canModerate, canRead, isAdmin, isModerator, from the same calculation as a fetched space’s memberPermissions (see How permissions are calculated). Present for a user with no membership too.