@replyke/core
Version:
Replyke: Build interactive apps with social features like comments, votes, feeds, user lists, notifications, and more.
20 lines • 787 B
JavaScript
import { useCallback } from "react";
import useProject from "../../projects/useProject";
import axios from "../../../config/axios";
function useFetchConnectionsCountByUserId() {
const { projectId } = useProject();
const fetchConnectionsCountByUserId = useCallback(async (props) => {
const { userId } = 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-count`);
return response.data;
}, [projectId]);
return fetchConnectionsCountByUserId;
}
export default useFetchConnectionsCountByUserId;
//# sourceMappingURL=useFetchConnectionsCountByUserId.js.map