useAcceptConnection
Overview
The useAcceptConnection hook allows the current logged-in user to accept an incoming connection request. This completes the connection process and establishes a mutual connection between two users.
Usage Example
Advanced Usage with Loading State
Usage in Notification System
Bulk Accept Connections
Parameters & Returns
Parameters
The hook returns a function that accepts an object with the following field:
The ID of the connection request to accept
Returns
The function returns a Promise that resolves to a ConnectionActionResponse object containing:
ISO date string of when the connection was accepted
Error Handling
The hook will throw errors in the following cases:
- No project is specified
- No user is logged in
- No connection ID is provided
- Connection request doesn’t exist or has already been processed
- Network connection issues
Use Cases
This hook is commonly used in:
- Connection request notification systems
- Inbox/messages interfaces for pending connections
- User dashboard for managing connection requests
- Mobile app notification handlers
- Bulk connection management tools
useDeclineConnection - Decline connection requests
useRequestConnection - Send new connection requests
useFetchReceivedPendingConnections - Get pending connection requests
useConnectionManager - Comprehensive connection state management