Fix redirection after save
[MAILPOET-3231]
This commit is contained in:
@@ -134,7 +134,14 @@ export const Form: React.FunctionComponent<Props> = ({
|
||||
</div>
|
||||
<SubscribersCounter />
|
||||
<div className="mailpoet-form-actions">
|
||||
<Button type="submit" onClick={(): void => { handleSave(segmentId); }} isDisabled={!isFormValid(segment)}>
|
||||
<Button
|
||||
type="submit"
|
||||
onClick={(e): void => {
|
||||
e.preventDefault();
|
||||
handleSave(segmentId);
|
||||
}}
|
||||
isDisabled={!isFormValid(segment)}
|
||||
>
|
||||
{MailPoet.I18n.t('save')}
|
||||
</Button>
|
||||
</div>
|
||||
|
@@ -56,7 +56,7 @@ export function* pageLoaded(segmentId?: number): Generator<{
|
||||
segmentId,
|
||||
}));
|
||||
if (!success || res.is_plugin_missing) {
|
||||
window.location.href = '#/segments';
|
||||
window.location.href = 'admin.php?page=mailpoet-segments#/segments';
|
||||
}
|
||||
yield setSegment(res);
|
||||
MailPoet.Modal.loading(false);
|
||||
@@ -90,7 +90,7 @@ export function* handleSave(segmentId?: number): Generator<{
|
||||
}));
|
||||
|
||||
if (success) {
|
||||
window.location.href = '#/segments';
|
||||
window.location.href = 'admin.php?page=mailpoet-segments#/segments';
|
||||
|
||||
if (segmentId !== undefined) {
|
||||
messages.onUpdate();
|
||||
|
@@ -11,6 +11,7 @@ import * as controls from './controls';
|
||||
import {
|
||||
StateType,
|
||||
SegmentFormDataWindow,
|
||||
SegmentTypes,
|
||||
} from '../types';
|
||||
|
||||
declare let window: SegmentFormDataWindow;
|
||||
@@ -27,7 +28,9 @@ export const createStore = (): void => {
|
||||
wooCurrencySymbol: window.mailpoet_woocommerce_currency_symbol,
|
||||
wooCountries: window.mailpoet_woocommerce_countries,
|
||||
customFieldsList: window.mailpoet_custom_fields,
|
||||
segment: {},
|
||||
segment: {
|
||||
segmentType: SegmentTypes.WordPressRole,
|
||||
},
|
||||
errors: [],
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user