@replyke/core
Version:
Replyke: Build interactive apps with social features like comments, votes, feeds, user lists, notifications, and more.
19 lines • 692 B
JavaScript
import { useCallback } from "react";
import useAxiosPrivate from "../../config/useAxiosPrivate";
import useProject from "../projects/useProject";
function useDeleteEntity() {
const axios = useAxiosPrivate();
const { projectId } = useProject();
const deleteEntity = useCallback(async ({ entityId }) => {
if (!projectId) {
throw new Error("No projectId available.");
}
if (!entityId) {
throw new Error("No entityId provided.");
}
await axios.delete(`/${projectId}/entities/${entityId}`);
}, [projectId, axios]);
return deleteEntity;
}
export default useDeleteEntity;
//# sourceMappingURL=useDeleteEntity.js.map