UNPKG

@replyke/core

Version:

Replyke: Build interactive apps with social features like comments, votes, feeds, user lists, notifications, and more.

25 lines 873 B
import { useCallback } from "react"; import useProject from "../../projects/useProject"; import axios from "../../../config/axios"; function useFetchConnectionsByUserId() { const { projectId } = useProject(); const fetchConnectionsByUserId = useCallback(async (props) => { const { userId, page = 1, limit = 20 } = props; if (!projectId) { throw new Error("No project specified"); } if (!userId) { throw new Error("No user ID was provided"); } const response = await axios.get(`/users/${userId}/connections`, { params: { page, limit, }, }); return response.data; }, [projectId]); return fetchConnectionsByUserId; } export default useFetchConnectionsByUserId; //# sourceMappingURL=useFetchConnectionsByUserId.js.map