UNPKG

@replyke/core

Version:

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

28 lines 949 B
import { useCallback } from "react"; import useAxiosPrivate from "../../../config/useAxiosPrivate"; import useProject from "../../projects/useProject"; import { useUser } from "../../user"; function useFetchConnections() { const axios = useAxiosPrivate(); const { projectId } = useProject(); const { user } = useUser(); const fetchConnections = useCallback(async (props = {}) => { const { page = 1, limit = 20 } = props; if (!projectId) { throw new Error("No project specified"); } if (!user) { throw new Error("No user is logged in"); } const response = await axios.get(`/connections`, { params: { page, limit, }, }); return response.data; }, [axios, projectId, user]); return fetchConnections; } export default useFetchConnections; //# sourceMappingURL=useFetchConnections.js.map