Fix Routes and paths for newsletter listing

Paths don't support regexps any more https://reactrouter.com/en/main/upgrading/v5#note-on-route-path-patterns
[MAILPOE-3911]
This commit is contained in:
Rostislav Wolny
2024-06-28 13:25:01 +02:00
committed by Aschepikov
parent 6a4e81bd88
commit a36d71850a

View File

@ -63,7 +63,7 @@ const Tabs = withNpsPoll(() => {
> >
<Tab <Tab
key="standard" key="standard"
route="standard/(.*)?" route="standard/*"
title={__('Newsletters', 'mailpoet')} title={__('Newsletters', 'mailpoet')}
automationId={`tab-${__('Newsletters', 'mailpoet')}`} automationId={`tab-${__('Newsletters', 'mailpoet')}`}
> >
@ -71,7 +71,7 @@ const Tabs = withNpsPoll(() => {
</Tab> </Tab>
<Tab <Tab
key="notification" key="notification"
route="notification/(.*)?" route="notification/*"
title={__('Post Notifications', 'mailpoet')} title={__('Post Notifications', 'mailpoet')}
automationId={`tab-${__('Post Notifications', 'mailpoet')}`} automationId={`tab-${__('Post Notifications', 'mailpoet')}`}
> >
@ -83,7 +83,7 @@ const Tabs = withNpsPoll(() => {
</Tab> </Tab>
<Tab <Tab
key="re_engagement" key="re_engagement"
route="re_engagement/(.*)?" route="re_engagement/*"
title={__('Re-engagement Emails', 'mailpoet')} title={__('Re-engagement Emails', 'mailpoet')}
automationId={`tab-${__('Re-engagement Emails', 'mailpoet')}`} automationId={`tab-${__('Re-engagement Emails', 'mailpoet')}`}
> >
@ -131,7 +131,15 @@ const routes = [
children: withBoundary(Tabs), children: withBoundary(Tabs),
}, },
{ {
path: '/(standard|notification|re_engagement)/(.*)?', path: '/standard/*',
children: withBoundary(Tabs),
},
{
path: '/notification/*',
children: withBoundary(Tabs),
},
{
path: '/re_engagement/*',
children: withBoundary(Tabs), children: withBoundary(Tabs),
}, },
/* New newsletter: types */ /* New newsletter: types */
@ -212,10 +220,9 @@ function App() {
<Route <Route
key={route.path} key={route.path}
path={route.path} path={route.path}
component={route.component}
name={route.name || null} name={route.name || null}
data={route.data || null} data={route.data || null}
element={route.children} element={<route.children />}
/> />
))} ))}
</Routes> </Routes>