Confirm card deletion
This commit is contained in:
parent
1db63c9615
commit
a3f113de6d
|
@ -12,6 +12,7 @@ function AdminCardDetail(props) {
|
|||
const [error, setError] = useState(false);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [success, setSuccess] = useState(false);
|
||||
const [yousure, setYousure] = useState(false);
|
||||
const id = card.id;
|
||||
|
||||
const handleValues = (e, v) => setInput({ ...input, [v.name]: v.value });
|
||||
|
@ -41,6 +42,7 @@ function AdminCardDetail(props) {
|
|||
const handleDelete = (e) => {
|
||||
e.preventDefault();
|
||||
|
||||
if (yousure) {
|
||||
requester('/cards/'+id+'/', 'DELETE', token)
|
||||
.then(res => {
|
||||
setInput(false);
|
||||
|
@ -48,6 +50,9 @@ function AdminCardDetail(props) {
|
|||
.catch(err => {
|
||||
console.log(err);
|
||||
});
|
||||
} else {
|
||||
setYousure(true);
|
||||
}
|
||||
};
|
||||
|
||||
const makeProps = (name) => ({
|
||||
|
@ -92,7 +97,7 @@ function AdminCardDetail(props) {
|
|||
color='red'
|
||||
onClick={handleDelete}
|
||||
>
|
||||
Delete
|
||||
{yousure ? 'You Sure?' : 'Delete'}
|
||||
</Form.Button>
|
||||
</Form.Group>
|
||||
</Form.Group>
|
||||
|
|
Loading…
Reference in New Issue
Block a user