@replyke/core
Version:
Replyke: Build interactive apps with social features like comments, votes, feeds, user lists, notifications, and more.
20 lines • 716 B
JavaScript
import { useCallback } from "react";
import useAxiosPrivate from "../../../config/useAxiosPrivate";
import useProject from "../../projects/useProject";
function useFollowUser() {
const axios = useAxiosPrivate();
const { projectId } = useProject();
const followUser = useCallback(async (props) => {
const { userId } = props;
if (!projectId) {
throw new Error("No project specified");
}
if (!userId) {
throw new Error("No user ID was provided");
}
await axios.post(`/${projectId}/users/${userId}/follow`, {});
}, [axios, projectId]);
return followUser;
}
export default useFollowUser;
//# sourceMappingURL=useFollowUser.js.map