Files
bruno/packages/bruno-app/src/components/Sidebar/Collections/Collection/RemoveCollection/index.js
Josh Soref 7313d1b4d7 spelling: occurred
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-09-28 14:11:49 -04:00

27 lines
818 B
JavaScript

import React from 'react';
import toast from 'react-hot-toast';
import Modal from 'components/Modal';
import { useDispatch } from 'react-redux';
import { removeCollection } from 'providers/ReduxStore/slices/collections/actions';
const RemoveCollection = ({ onClose, collection }) => {
const dispatch = useDispatch();
const onConfirm = () => {
dispatch(removeCollection(collection.uid))
.then(() => {
toast.success('Collection removed');
onClose();
})
.catch(() => toast.error('An error occurred while removing the collection'));
};
return (
<Modal size="sm" title="Remove Collection" confirmText="Remove" handleConfirm={onConfirm} handleCancel={onClose}>
Are you sure you want to remove this collection?
</Modal>
);
};
export default RemoveCollection;