Merge pull request #237 from answerdev/feat/1.0.6/ui

fix(Question): Dealing with Modal not disappearing after closing Ques…
This commit is contained in:
haitao.jarvis 2023-03-03 17:40:31 +08:00 committed by GitHub
commit 4c7f658a78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 4 deletions

View File

@ -47,7 +47,11 @@ const useReportModal = (callback?: () => void) => {
setShow(true); setShow(true);
}); });
}; };
const asyncCallback = () => {
setTimeout(() => {
callback?.();
});
};
const handleRadio = (val) => { const handleRadio = (val) => {
setInvalidState(false); setInvalidState(false);
setContent({ setContent({
@ -93,8 +97,8 @@ const useReportModal = (callback?: () => void) => {
close_type: reportType.type, close_type: reportType.type,
close_msg: content.value, close_msg: content.value,
}).then(() => { }).then(() => {
callback?.();
onClose(); onClose();
asyncCallback();
}); });
return; return;
} }
@ -109,8 +113,8 @@ const useReportModal = (callback?: () => void) => {
msg: t('flag_success', { keyPrefix: 'toast' }), msg: t('flag_success', { keyPrefix: 'toast' }),
variant: 'warning', variant: 'warning',
}); });
callback?.();
onClose(); onClose();
asyncCallback();
}); });
} }
@ -121,8 +125,8 @@ const useReportModal = (callback?: () => void) => {
flagged_type: reportType.type, flagged_type: reportType.type,
id: params.id, id: params.id,
}).then(() => { }).then(() => {
callback?.();
onClose(); onClose();
asyncCallback();
}); });
} }
}; };