UNPKG

@replyke/core

Version:

Replyke: Build interactive apps with social features like comments, votes, feeds, user lists, notifications, and more.

26 lines 977 B
import { useCallback } from "react"; import useAxiosPrivate from "../../../config/useAxiosPrivate"; import useProject from "../../projects/useProject"; import { useUser } from "../../user"; function useDeclineConnection() { const axios = useAxiosPrivate(); const { projectId } = useProject(); const { user } = useUser(); const declineConnection = useCallback(async (props) => { const { connectionId } = props; if (!projectId) { throw new Error("No project specified"); } if (!user) { throw new Error("No user is logged in"); } if (!connectionId) { throw new Error("No connection ID was provided"); } const response = await axios.patch(`/connections/${connectionId}/decline`, {}); return response.data; }, [axios, projectId, user]); return declineConnection; } export default useDeclineConnection; //# sourceMappingURL=useDeclineConnection.js.map