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