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