Overview
High-level hook that fetches the connection status between the current user and a target user on mount, then exposes named action functions for every state transition. The appropriate action for each state is enforced — only valid transitions can fire. For integration guidance and a full example, see Relationships — useConnectionManager.Usage Example
Parameters
Returns
One of:
"none" | "pending-sent" | "pending-received" | "accepted" | "declined-sent" | "declined-received". It is the connection’s status, joined with its type while pending or declined ("pending-sent": the current user sent the request), or "none" when no connection exists.The connection record seen from the current user’s side (
user is the target user), or null if there is none. See ConnectionRow.Sends a connection request. Only active when status is
"none" or "declined-received"; the server rejects a new request while a declined one exists between the two users (409 connection/request-declined), so in "declined-received" the call fails. When the server answers with an existing row (your request was already pending, or you were connected meanwhile), the state takes that row. When the other user sent you a request meanwhile (409 connection/request-received), the call fails and the state takes their request from the error body, so connectionStatus becomes "pending-received" and acceptConnectionRequest works.Acts on the connection by user ID, whatever its state: withdraws a sent request, declines a received one, or disconnects an accepted connection. Does nothing when status is
"none", "declined-sent" or "declined-received". After declining a received request it re-reads the status, so connection holds the declined record.
