@replyke/core
Version:
Replyke: Build interactive apps with social features like comments, votes, feeds, user lists, notifications, and more.
28 lines • 1.04 kB
JavaScript
import { useCallback } from "react";
import useAxiosPrivate from "../../../config/useAxiosPrivate";
import useProject from "../../projects/useProject";
import { useUser } from "../../user";
function useFetchReceivedPendingConnections() {
const axios = useAxiosPrivate();
const { projectId } = useProject();
const { user } = useUser();
const fetchReceivedPendingConnections = 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/pending/received", {
params: {
page,
limit,
},
});
return response.data;
}, [axios, projectId, user]);
return fetchReceivedPendingConnections;
}
export default useFetchReceivedPendingConnections;
//# sourceMappingURL=useFetchReceivedPendingConnections.js.map