@replyke/core
Version:
Replyke: Build interactive apps with social features like comments, votes, feeds, user lists, notifications, and more.
19 lines • 778 B
JavaScript
import { useCallback } from "react";
import useProject from "../../projects/useProject";
import axios from "../../../config/axios";
function useFetchFollowersByUserId() {
const { projectId } = useProject();
const fetchFollowersByUserId = useCallback(async ({ userId, page = 1, limit = 20 }) => {
if (!userId) {
throw new Error("No userId provided.");
}
if (!projectId) {
throw new Error("No projectId available.");
}
const response = await axios.get(`/${projectId}/users/${userId}/followers`, { params: { page, limit } });
return response.data;
}, [projectId]);
return fetchFollowersByUserId;
}
export default useFetchFollowersByUserId;
//# sourceMappingURL=useFetchFollowersByUserId.js.map