close modal when user clicks cancel (#3656)

* close modal when user clicks cancel

* close modal when delete image context cleared

---------

Co-authored-by: Mary Hipp <maryhipp@Marys-MacBook-Air.local>
This commit is contained in:
Mary Hipp Rogers 2023-07-05 13:12:27 -04:00 committed by GitHub
parent 8283b80b58
commit ea81ce9489
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 0 deletions

View File

@ -23,6 +23,7 @@ import { stateSelector } from 'app/store/store';
import {
imageDeletionConfirmed,
imageToDeleteCleared,
isModalOpenChanged,
selectImageUsage,
} from '../store/imageDeletionSlice';
@ -63,6 +64,7 @@ const DeleteImageModal = () => {
const handleClose = useCallback(() => {
dispatch(imageToDeleteCleared());
dispatch(isModalOpenChanged(false));
}, [dispatch]);
const handleDelete = useCallback(() => {

View File

@ -31,6 +31,7 @@ const imageDeletion = createSlice({
},
imageToDeleteCleared: (state) => {
state.imageToDelete = null;
state.isModalOpen = false;
},
},
});