Scroll to the top after saving

[MAILPOET-2677]
This commit is contained in:
Amine Ben hammou
2020-03-12 01:21:32 +01:00
committed by Veljko V
parent 4ea653b81f
commit 918fb4bd87

View File

@@ -14,8 +14,8 @@ export default () => {
const showSuccess = notices.success;
React.useEffect(() => {
if (clicked && !isSaving) {
if (error) showError(error.map((err) => <p>{err}</p>));
else showSuccess(<p>{MailPoet.I18n.t('settingsSaved')}</p>);
if (error) showError(error.map((err) => <p>{err}</p>), { scroll: true });
else showSuccess(<p>{MailPoet.I18n.t('settingsSaved')}</p>, { scroll: true });
}
}, [clicked, error, isSaving, showError, showSuccess]);
const onClick = () => {