From 7d94e2fbbdb7d893dfff3260d9926fa7d740b95f Mon Sep 17 00:00:00 2001 From: Rostislav Wolny Date: Wed, 5 Aug 2020 12:13:22 +0200 Subject: [PATCH] Load proper subscriber filters on save [MAILPOET-3054] --- assets/js/src/subscribers/form.jsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/assets/js/src/subscribers/form.jsx b/assets/js/src/subscribers/form.jsx index 83174c5d8a..fc182fb830 100644 --- a/assets/js/src/subscribers/form.jsx +++ b/assets/js/src/subscribers/form.jsx @@ -1,5 +1,5 @@ import React from 'react'; -import { Link, useLocation } from 'react-router-dom'; +import { Link, useLocation, useHistory } from 'react-router-dom'; import MailPoet from 'mailpoet'; import moment from 'moment'; import PropTypes from 'prop-types'; @@ -211,11 +211,13 @@ function afterFormContent(values) { const SubscriberForm = ({ match }) => { const location = useLocation(); + const history = useHistory(); + const backUrl = location.state?.backUrl || '/'; return (

{MailPoet.I18n.t('subscriber')} - {MailPoet.I18n.t('backToList')} + {MailPoet.I18n.t('backToList')}

@@ -228,6 +230,7 @@ const SubscriberForm = ({ match }) => { messages={messages} beforeFormContent={beforeFormContent} afterFormContent={afterFormContent} + onSuccess={() => history.push(backUrl)} />
);