mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-05-31 17:46:17 +00:00
Registered first components as services
This commit is contained in:
20
src/container/index.js
Normal file
20
src/container/index.js
Normal file
@@ -0,0 +1,20 @@
|
||||
import Bottle from 'bottlejs';
|
||||
import { withRouter } from 'react-router-dom';
|
||||
import { connect } from 'react-redux';
|
||||
import { pick } from 'ramda';
|
||||
import App from '../App';
|
||||
import ScrollToTop from '../common/ScrollToTop';
|
||||
import MainHeader from '../common/MainHeader';
|
||||
import { resetSelectedServer } from '../servers/reducers/selectedServer';
|
||||
import Home from '../common/Home';
|
||||
import store from './store';
|
||||
|
||||
const bottle = new Bottle();
|
||||
|
||||
bottle.constant('store', store);
|
||||
bottle.serviceFactory('App', App, 'MainHeader', 'Home');
|
||||
bottle.serviceFactory('MainHeader', () => withRouter(MainHeader()));
|
||||
bottle.serviceFactory('ScrollToTop', () => withRouter(ScrollToTop));
|
||||
bottle.serviceFactory('Home', () => connect(pick([ 'servers' ]), { resetSelectedServer })(Home));
|
||||
|
||||
export default bottle.container;
|
||||
13
src/container/store.js
Normal file
13
src/container/store.js
Normal file
@@ -0,0 +1,13 @@
|
||||
import ReduxThunk from 'redux-thunk';
|
||||
import { applyMiddleware, compose, createStore } from 'redux';
|
||||
import reducers from '../reducers';
|
||||
|
||||
const composeEnhancers = process.env.NODE_ENV !== 'production' && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__
|
||||
? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__
|
||||
: compose;
|
||||
|
||||
const store = createStore(reducers, composeEnhancers(
|
||||
applyMiddleware(ReduxThunk)
|
||||
));
|
||||
|
||||
export default store;
|
||||
Reference in New Issue
Block a user