mirror of
https://github.com/elyby/accounts-frontend.git
synced 2025-05-31 14:11:58 +05:30
Move App into shell dir. Decouple ContextProviders. Improved type coverage for reducers
This commit is contained in:
24
packages/app/shell/App.tsx
Normal file
24
packages/app/shell/App.tsx
Normal file
@@ -0,0 +1,24 @@
|
||||
import React from 'react';
|
||||
import { hot } from 'react-hot-loader/root';
|
||||
import { Route, Switch } from 'react-router-dom';
|
||||
import { Store } from 'app/reducers';
|
||||
import AuthFlowRoute from 'app/containers/AuthFlowRoute';
|
||||
import RootPage from 'app/pages/root/RootPage';
|
||||
import SuccessOauthPage from 'app/pages/auth/SuccessOauthPage';
|
||||
|
||||
import ContextProvider from './ContextProvider';
|
||||
|
||||
const App = ({ store, history }: { store: Store; history: any }) => (
|
||||
<ContextProvider store={store} history={history}>
|
||||
<Switch>
|
||||
<Route path="/oauth2/code/success" component={SuccessOauthPage} />
|
||||
<AuthFlowRoute
|
||||
path="/oauth2/:version(v\d+)/:clientId?"
|
||||
component={() => null}
|
||||
/>
|
||||
<Route path="/" component={RootPage} />
|
||||
</Switch>
|
||||
</ContextProvider>
|
||||
);
|
||||
|
||||
export default hot(App);
|
25
packages/app/shell/ContextProvider.tsx
Normal file
25
packages/app/shell/ContextProvider.tsx
Normal file
@@ -0,0 +1,25 @@
|
||||
import React from 'react';
|
||||
import { Provider as ReduxProvider } from 'react-redux';
|
||||
import { Router } from 'react-router-dom';
|
||||
import { IntlProvider } from 'app/components/i18n';
|
||||
import { Store } from 'app/reducers';
|
||||
|
||||
function ContextProvider({
|
||||
children,
|
||||
store,
|
||||
history,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
store: Store;
|
||||
history: any;
|
||||
}) {
|
||||
return (
|
||||
<ReduxProvider store={store}>
|
||||
<IntlProvider>
|
||||
<Router history={history}>{children}</Router>
|
||||
</IntlProvider>
|
||||
</ReduxProvider>
|
||||
);
|
||||
}
|
||||
|
||||
export default ContextProvider;
|
2
packages/app/shell/index.ts
Normal file
2
packages/app/shell/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export { default } from './App';
|
||||
export { default as ContextProvider } from './ContextProvider';
|
Reference in New Issue
Block a user