Created
August 17, 2017 10:33
-
-
Save razdvapoka/da4f17727a88d27b1ac2ba175b42de7b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import './assets/emoji-picker.css' | |
import React, { Component } from 'react' | |
import { chatsApi, infoApi } from './api' | |
import AppAside from './AppAside' | |
import { | |
preloadDataSuccess as chatsPreloadDataSuccess | |
} from './views/chats/chatsActions' | |
import { | |
preloadDataSuccess as infoPreloadDataSuccess | |
} from './views/info/infoActions' | |
import { preload } from 'redux-router-preload' | |
import styles from './App.css' | |
class App extends Component { | |
render() { | |
const { | |
children | |
} = this.props | |
return ( | |
<div className={styles.app}> | |
<div className={styles.aside}> | |
<AppAside /> | |
</div> | |
<div className={styles.contentContainer}> | |
{children} | |
</div> | |
</div> | |
) | |
} | |
} | |
const appPreload = ((dispatch, _, {axios}) => | |
Promise.all([ | |
chatsApi.fetchChats(undefined, axios), | |
infoApi.fetchInfo(undefined, axios) | |
]).then(([ chats, info ]) => { | |
dispatch(chatsPreloadDataSuccess(chats)) | |
dispatch(infoPreloadDataSuccess(info)) | |
})) | |
export default preload(appPreload)(App) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment