@selfcommunity/react-core
Version:
React Core Components useful for integrating UI Community components (react-ui).
44 lines (41 loc) • 1.24 kB
TypeScript
import { SCUserType } from '@selfcommunity/types';
/**
:::info
This custom hook is used to manage to manage friends.
:::
:::tip How to use it:
Follow these steps:
```jsx
1. const scUserContext: SCUserContextType = useSCUser();
2. const scConnectionsManager: SCConnectionsManagerType = scUserContext.manager.connections;
3. scConnectionsManager.status(user)
```
:::
*/
export default function useSCConnectionsManager(user?: SCUserType): {
connections: any[];
loading: any[];
isLoading: (v: number | {
id: number;
}) => boolean;
status?: undefined;
requestConnection?: undefined;
cancelRequestConnection?: undefined;
acceptConnection?: undefined;
removeConnection?: undefined;
refresh?: undefined;
emptyCache?: undefined;
} | {
connections: any[];
loading: any[];
isLoading: (v: number | {
id: number;
}) => boolean;
status: (user: SCUserType) => string;
requestConnection: (user: SCUserType) => Promise<any>;
cancelRequestConnection: (user: SCUserType) => Promise<any>;
acceptConnection: (user: SCUserType) => Promise<any>;
removeConnection: (user: SCUserType) => Promise<any>;
refresh: () => void;
emptyCache: () => void;
};