58 lines
1.2 KiB
JavaScript
Executable File
58 lines
1.2 KiB
JavaScript
Executable File
|
|
import React, { PropTypes } from 'react'
|
|
import { connect } from 'react-redux'
|
|
import { bindActionCreators } from 'redux'
|
|
|
|
import Header from '../../components/Header'
|
|
|
|
import * as spotifyActions from '../../services/spotify/actions'
|
|
|
|
class Discover extends React.Component{
|
|
|
|
constructor(props) {
|
|
super(props);
|
|
}
|
|
|
|
// on render
|
|
componentDidMount(){
|
|
this.props.spotifyActions.getPlaylist( this.props.params.uri );
|
|
}
|
|
|
|
// when props changed
|
|
componentWillReceiveProps( nextProps ){
|
|
if( nextProps.params.uri != this.props.params.uri ){
|
|
this.props.spotifyActions.getPlaylist( nextProps.params.uri );
|
|
}
|
|
}
|
|
|
|
render(){
|
|
if( this.props.spotify.playlist ){
|
|
return (
|
|
<div className="view discover-view">
|
|
<Header icon="compass" title="Discover" />
|
|
<h1>To come</h1>
|
|
</div>
|
|
);
|
|
}
|
|
return null;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
* Export our component
|
|
*
|
|
* We also integrate our global store, using connect()
|
|
**/
|
|
|
|
const mapStateToProps = (state, ownProps) => {
|
|
return state;
|
|
}
|
|
|
|
const mapDispatchToProps = (dispatch) => {
|
|
return {
|
|
spotifyActions: bindActionCreators(spotifyActions, dispatch)
|
|
}
|
|
}
|
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(Discover) |