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