Skip to main content

Overview

Returns a function that fetches the full connection status between the current authenticated user and a target user. Returns a discriminated union based on the current state: "none", "pending", "connected", or "declined". useConnectionManager calls this automatically on mount. Use this hook directly when you need one-off status checks without managing state.

Usage Example

Parameters

The hook returns a function. That function accepts:
string
required
The ID of the user to check. Cannot be the current user’s own ID.

Returns

Returns a ConnectionStatusResponse — a discriminated union based on status: When status === "none":
"none"
No connection exists.
When status === "pending":
"pending"
A connection request is pending.
"sent" | "received"
Direction from the current user’s perspective.
string
The connection record ID.
string
ISO timestamp when the request was created.
When status === "connected":
"connected"
Connection is established.
string
The connection record ID.
string
ISO timestamp when the connection was established.
string
ISO timestamp when the request was originally sent.
When status === "declined":
"declined"
A connection request was declined.
"sent" | "received"
Direction of the original request.
string
The connection record ID.
string
ISO timestamp when the request was declined.