diff --git a/public/script.js b/public/script.js index 4cb6ae0..58392d3 100644 --- a/public/script.js +++ b/public/script.js @@ -240,23 +240,17 @@ var App = React.createClass({ return !(this.state.access_token == null && this.state.refresh_token == null); }, refreshAuth: function (access, refresh) { - if (access == null && refresh == null) { - this.setState({ - access_token: access, - refresh_token: refresh, - playlists: null - }); - } - else { - this.setState({ - access_token: access, - refresh_token: refresh - }); + this.setState({ + access_token: access, + refresh_token: refresh + }); + + if (!(access == null && refresh == null)) { this.getPlaylists(); } }, componentDidMount: function () { - if (this.state.access_token) { + if (this.isLoggedIn()) { this.getPlaylists(); } }, @@ -265,10 +259,10 @@ var App = React.createClass({ access_token: this.state.access_token, refresh_token: this.state.refresh_token }; - var content =
Please log in with Spotify :)
+ var content =Please log in with Spotify :)
; if (this.isLoggedIn()) { content = ( -