UNPKG

@replyke/core

Version:

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

24 lines 844 B
import { useCallback } from "react"; import useProject from "../../projects/useProject"; import axios from "../../../config/axios"; function useFetchFollowingByUserId() { const { projectId } = useProject(); const fetchFollowingByUserId = useCallback(async ({ userId, page = 1, limit = 20 }) => { if (!userId) { throw new Error("No userId provided."); } if (!projectId) { throw new Error("No projectId available."); } const response = await axios.get(`/${projectId}/users/${userId}/following`, { params: { page, limit, }, }); return response.data; }, [projectId]); return fetchFollowingByUserId; } export default useFetchFollowingByUserId; //# sourceMappingURL=useFetchFollowingByUserId.js.map