Add context to newsletters entrypoint

[MAILPOET-2389]
This commit is contained in:
Amine Ben hammou
2019-11-27 13:46:53 +01:00
committed by Jack Kitterhing
parent 41697e1580
commit 89d0362f13

View File

@ -20,6 +20,7 @@ import NewsletterListNotification from 'newsletters/listings/notification.jsx';
import NewsletterListNotificationHistory from 'newsletters/listings/notification_history.jsx'; import NewsletterListNotificationHistory from 'newsletters/listings/notification_history.jsx';
import NewsletterSendingStatus from 'newsletters/sending_status.jsx'; import NewsletterSendingStatus from 'newsletters/sending_status.jsx';
import CampaignStatsPage from 'newsletters/campaign_stats/page.jsx'; import CampaignStatsPage from 'newsletters/campaign_stats/page.jsx';
import { GlobalContext, useGlobalContextValue } from 'context/index.jsx';
const getAutomaticEmailsRoutes = () => { const getAutomaticEmailsRoutes = () => {
if (!window.mailpoet_automatic_emails) return null; if (!window.mailpoet_automatic_emails) return null;
@ -98,6 +99,7 @@ const routes = Hooks.applyFilters('mailpoet_newsletters_before_router', [
]); ]);
const App = () => ( const App = () => (
<GlobalContext.Provider value={useGlobalContextValue(window)}>
<HashRouter> <HashRouter>
<Switch> <Switch>
<Route exact path="/" render={() => <Redirect to="/standard" />} /> <Route exact path="/" render={() => <Redirect to="/standard" />} />
@ -113,6 +115,7 @@ const App = () => (
))} ))}
</Switch> </Switch>
</HashRouter> </HashRouter>
</GlobalContext.Provider>
); );
const container = document.getElementById('newsletters_container'); const container = document.getElementById('newsletters_container');