@replyke/core
Version:
Replyke: Build interactive apps with social features like comments, votes, feeds, user lists, notifications, and more.
22 lines • 827 B
JavaScript
import { useCallback } from "react";
import useAxiosPrivate from "../../../config/useAxiosPrivate";
import useProject from "../../projects/useProject";
import { useUser } from "../../user";
function useFetchConnectionsCount() {
const axios = useAxiosPrivate();
const { projectId } = useProject();
const { user } = useUser();
const fetchConnectionsCount = useCallback(async () => {
if (!projectId) {
throw new Error("No project specified");
}
if (!user) {
throw new Error("No user is logged in");
}
const response = await axios.get("/connections/count");
return response.data;
}, [axios, projectId, user]);
return fetchConnectionsCount;
}
export default useFetchConnectionsCount;
//# sourceMappingURL=useFetchConnectionsCount.js.map