mirror of
https://github.com/strapi/strapi.git
synced 2025-08-13 19:27:34 +00:00
lockApp on deleteAll
Signed-off-by: Virginie Ky <virginie.ky@gmail.com>
This commit is contained in:
parent
1274645f0e
commit
3c5cb15c31
@ -6,7 +6,7 @@ const Overlay = styled.div`
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
z-index: 1040;
|
||||
z-index: 1140;
|
||||
&:before {
|
||||
content: '';
|
||||
position: fixed;
|
||||
|
@ -79,7 +79,9 @@ const EditForm = forwardRef(
|
||||
useEffect(() => {
|
||||
if (isImg || isVideo) {
|
||||
if (prefixedFileURL) {
|
||||
setSrc(prefixedFileURL);
|
||||
// Adding performance.now forces the browser no to cache the img
|
||||
// https://stackoverflow.com/questions/126772/how-to-force-a-web-browser-not-to-cache-images
|
||||
setSrc(`${prefixedFileURL}?${performance.now()}`);
|
||||
} else {
|
||||
const reader = new FileReader();
|
||||
|
||||
|
@ -212,11 +212,8 @@ const HomePage = () => {
|
||||
|
||||
const handleDeleteMediaFromModal = async id => {
|
||||
handleClickToggleModal();
|
||||
const overlayblockerParams = {
|
||||
children: <div />,
|
||||
noGradient: true,
|
||||
};
|
||||
strapi.lockApp(overlayblockerParams);
|
||||
|
||||
lockAppWithOverlay();
|
||||
|
||||
try {
|
||||
await deleteMedia(id);
|
||||
@ -235,14 +232,22 @@ const HomePage = () => {
|
||||
};
|
||||
|
||||
const handleDeleteMedias = async () => {
|
||||
await Promise.all(dataToDelete.map(item => deleteMedia(item.id)));
|
||||
|
||||
dispatch({
|
||||
type: 'CLEAR_DATA_TO_DELETE',
|
||||
});
|
||||
|
||||
setIsPopupOpen(false);
|
||||
fetchListData();
|
||||
|
||||
lockAppWithOverlay();
|
||||
|
||||
await Promise.all(dataToDelete.map(item => deleteMedia(item.id)))
|
||||
.then(() => {
|
||||
dispatch({
|
||||
type: 'CLEAR_DATA_TO_DELETE',
|
||||
});
|
||||
|
||||
fetchListData();
|
||||
strapi.unlockApp();
|
||||
})
|
||||
.catch(() => {
|
||||
strapi.unlockApp();
|
||||
});
|
||||
};
|
||||
|
||||
const handleModalClose = () => {
|
||||
@ -260,6 +265,15 @@ const HomePage = () => {
|
||||
});
|
||||
};
|
||||
|
||||
const lockAppWithOverlay = () => {
|
||||
const overlayblockerParams = {
|
||||
children: <div />,
|
||||
noGradient: true,
|
||||
};
|
||||
|
||||
strapi.lockApp(overlayblockerParams);
|
||||
};
|
||||
|
||||
const resetModalState = () => {
|
||||
setModalInitialStep('browse');
|
||||
setFileToEdit(null);
|
||||
|
Loading…
x
Reference in New Issue
Block a user