@replyke/core
Version:
Replyke: Build interactive apps with social features like comments, votes, feeds, user lists, notifications, and more.
27 lines • 933 B
JavaScript
import { useCallback } from "react";
import useAxiosPrivate from "../../../config/useAxiosPrivate";
import useProject from "../../projects/useProject";
import { useUser } from "../../user";
function useFetchFollowing() {
const axios = useAxiosPrivate();
const { projectId } = useProject();
const { user } = useUser();
const fetchFollowing = 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/following`, {
params: {
page,
limit,
},
});
return response.data;
}, [axios, projectId, user]);
return fetchFollowing;
}
export default useFetchFollowing;
//# sourceMappingURL=useFetchFollowing.js.map