Wrapping mopidy service and connecting store
This commit is contained in:
@ -1,4 +1,8 @@
|
||||
|
||||
/**
|
||||
* Root level application
|
||||
**/
|
||||
|
||||
import React, { PropTypes } from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import { createStore, bindActionCreators } from 'redux'
|
||||
@ -9,16 +13,10 @@ import * as actions from '../actions/index'
|
||||
import Services from '../services/Services'
|
||||
|
||||
|
||||
/**
|
||||
* The application 'brain'
|
||||
*
|
||||
* All data handling and fetching is done through this handler
|
||||
**/
|
||||
class App extends React.Component{
|
||||
|
||||
constructor(props){
|
||||
super(props);
|
||||
|
||||
this.handleClick = this.handleClick.bind(this);
|
||||
}
|
||||
|
||||
|
||||
@ -18,13 +18,9 @@ class NowPlaying extends React.Component{
|
||||
|
||||
// on render
|
||||
componentDidMount(){
|
||||
var self = this;
|
||||
Services.get('services.mopidy')
|
||||
.then( function(MopidyService){
|
||||
MopidyService.connection.tracklist.getTlTracks()
|
||||
.then( function(tracks){
|
||||
self.setState({ tracks : tracks });
|
||||
});
|
||||
MopidyService.getCurrentTracklist();
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user