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;
|
right: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
z-index: 1040;
|
z-index: 1140;
|
||||||
&:before {
|
&:before {
|
||||||
content: '';
|
content: '';
|
||||||
position: fixed;
|
position: fixed;
|
||||||
|
@ -79,7 +79,9 @@ const EditForm = forwardRef(
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isImg || isVideo) {
|
if (isImg || isVideo) {
|
||||||
if (prefixedFileURL) {
|
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 {
|
} else {
|
||||||
const reader = new FileReader();
|
const reader = new FileReader();
|
||||||
|
|
||||||
|
@ -212,11 +212,8 @@ const HomePage = () => {
|
|||||||
|
|
||||||
const handleDeleteMediaFromModal = async id => {
|
const handleDeleteMediaFromModal = async id => {
|
||||||
handleClickToggleModal();
|
handleClickToggleModal();
|
||||||
const overlayblockerParams = {
|
|
||||||
children: <div />,
|
lockAppWithOverlay();
|
||||||
noGradient: true,
|
|
||||||
};
|
|
||||||
strapi.lockApp(overlayblockerParams);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await deleteMedia(id);
|
await deleteMedia(id);
|
||||||
@ -235,14 +232,22 @@ const HomePage = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleDeleteMedias = async () => {
|
const handleDeleteMedias = async () => {
|
||||||
await Promise.all(dataToDelete.map(item => deleteMedia(item.id)));
|
|
||||||
|
|
||||||
dispatch({
|
|
||||||
type: 'CLEAR_DATA_TO_DELETE',
|
|
||||||
});
|
|
||||||
|
|
||||||
setIsPopupOpen(false);
|
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 = () => {
|
const handleModalClose = () => {
|
||||||
@ -260,6 +265,15 @@ const HomePage = () => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const lockAppWithOverlay = () => {
|
||||||
|
const overlayblockerParams = {
|
||||||
|
children: <div />,
|
||||||
|
noGradient: true,
|
||||||
|
};
|
||||||
|
|
||||||
|
strapi.lockApp(overlayblockerParams);
|
||||||
|
};
|
||||||
|
|
||||||
const resetModalState = () => {
|
const resetModalState = () => {
|
||||||
setModalInitialStep('browse');
|
setModalInitialStep('browse');
|
||||||
setFileToEdit(null);
|
setFileToEdit(null);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user