Snapcast config via pusher

This commit is contained in:
James Barnsley
2018-03-26 10:36:13 +13:00
parent 5ab256b31b
commit 96d4ec3bdf
12 changed files with 274 additions and 244 deletions

View File

@ -24,14 +24,20 @@ class Snapcast extends React.Component{
}
componentDidMount(){
if (this.props.pusher_connected){
if (this.props.pusher_connected && this.props.snapcast_enabled){
this.props.pusherActions.getSnapcast();
}
}
componentWillReceiveProps(newProps){
// Just connected
if (!this.props.pusher_connected && newProps.pusher_connected){
this.props.pusherActions.getSnapcast();
// Just enabled (well, identified as being enabled)
} else if (!this.props.pusher_enabled && newProps.pusher_enabled && newProps.pusher_connected){
this.props.pusherActions.getSnapcast();
}
}
@ -118,6 +124,7 @@ class Snapcast extends React.Component{
const mapStateToProps = (state, ownProps) => {
return {
snapcast_enabled: state.pusher.config.snapcast_enabled,
pusher_connected: state.pusher.connected,
snapcast_groups: state.pusher.snapcast_groups,
snapcast_clients: state.pusher.snapcast_clients