Redirect to segments listing after segment editing
[MAILPOET-3490]
This commit is contained in:
@ -354,6 +354,7 @@ class SegmentList extends React.Component {
|
||||
messages={messages}
|
||||
search={false}
|
||||
endpoint="segments"
|
||||
base_url="lists"
|
||||
onRenderItem={this.renderItem}
|
||||
columns={columns}
|
||||
bulk_actions={bulkActions}
|
||||
|
@ -1,6 +1,8 @@
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import { HashRouter, Switch, Route } from 'react-router-dom';
|
||||
import {
|
||||
HashRouter, Switch, Route, Redirect,
|
||||
} from 'react-router-dom';
|
||||
|
||||
import MailPoet from 'mailpoet';
|
||||
import RoutedTabs from 'common/tabs/routed_tabs';
|
||||
@ -18,8 +20,12 @@ const container = document.getElementById('segments_container');
|
||||
const Tabs = () => (
|
||||
<>
|
||||
<ListHeading />
|
||||
<RoutedTabs activeKey="" routerType="switch-only">
|
||||
<Tab key="" route="*" title={MailPoet.I18n.t('pageTitle')}>
|
||||
<RoutedTabs activeKey="lists" routerType="switch-only">
|
||||
<Tab
|
||||
key="lists"
|
||||
route="lists/(.*)?"
|
||||
title={MailPoet.I18n.t('pageTitle')}
|
||||
>
|
||||
<SegmentList />
|
||||
</Tab>
|
||||
<Tab
|
||||
@ -39,12 +45,13 @@ const App = () => (
|
||||
<HashRouter>
|
||||
<Notices />
|
||||
<Switch>
|
||||
<Route exact path="/" render={() => <Redirect to="/lists" />} />
|
||||
<Route path="/new" component={SegmentForm} />
|
||||
<Route path="/edit/:id" component={SegmentForm} />
|
||||
<Route path="/new-segment" component={DynamicSegmentForm} />
|
||||
<Route path="/edit-segment/:id" component={DynamicSegmentForm} />
|
||||
<Route path="/segments/(.*)?" component={Tabs} />
|
||||
<Route path="*" component={Tabs} />
|
||||
<Route path="/lists/(.*)?" component={Tabs} />
|
||||
</Switch>
|
||||
</HashRouter>
|
||||
</GlobalContext.Provider>
|
||||
|
@ -195,6 +195,7 @@ class DynamicSegments extends APIEndpoint {
|
||||
}
|
||||
|
||||
public function listing($data = []) {
|
||||
$data['params'] = $data['params'] ?? ['segments']; // Dummy param to apply constraints properly
|
||||
$definition = $this->listingHandler->getListingDefinition($data);
|
||||
$items = $this->dynamicSegmentsListingRepository->getData($definition);
|
||||
$count = $this->dynamicSegmentsListingRepository->getCount($definition);
|
||||
|
@ -84,6 +84,7 @@ class Segments extends APIEndpoint {
|
||||
}
|
||||
|
||||
public function listing($data = []) {
|
||||
$data['params'] = $data['params'] ?? ['lists']; // Dummy param to apply constraints properly
|
||||
$definition = $this->listingHandler->getListingDefinition($data);
|
||||
$items = $this->segmentListingRepository->getData($definition);
|
||||
$count = $this->segmentListingRepository->getCount($definition);
|
||||
|
Reference in New Issue
Block a user