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