import React from 'react' import { connect } from 'react-redux' import { MainPage, TgAccountSettingsPage, BillingPage, CallCard } from '../pages' const mapStateToProps = (state) => ({ path: state.__route.current.path, datas: state.__route.current.datas, }) const AppRouter = ({path, datas}) => { const render = Component => <Component {...datas} /> switch (path) { case 'settings': return render(TgAccountSettingsPage) case 'billing': return render(BillingPage) case 'plc_call_card': return render(CallCard) default: return render(MainPage) } } export default connect(mapStateToProps, null)(AppRouter)