text: require("source-map-support").install();
  exports.id = 1;
  exports.modules = {
  
  /***/ "./src/routes/playlist/Playlist.js":
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
  
  "use strict";
  /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react__ = __webpack_require__(0);
  /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_react__);
  /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_spotify_web_api_node__ = __webpack_require__(24);
  /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_spotify_web_api_node___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_spotify_web_api_node__);
  /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Playlist_css__ = __webpack_require__("./src/routes/playlist/Playlist.css");
  /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Playlist_css___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2__Playlist_css__);
  /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_classnames__ = __webpack_require__(26);
  /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_classnames___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_classnames__);
  /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_isomorphic_style_loader_lib_withStyles__ = __webpack_require__(5);
  /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_isomorphic_style_loader_lib_withStyles___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_isomorphic_style_loader_lib_withStyles__);
  /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_moment__ = __webpack_require__(27);
  /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_moment___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_moment__);
  var _jsxFileName = '/Users/stephanie/dev/votelist/src/routes/playlist/Playlist.js';
  
  
  
  
  
  
  
  const CLIENT_ID = 'b8ae36286f1c4db28a8a2ba380a4d8cc';
  const CLIENT_SECRET = '18cfc75e9f4b4785ac325eaa38a095c9';
  const REDIRECT_URI = 'http://localhost:3000/callback';
  
  class Playlist extends __WEBPACK_IMPORTED_MODULE_0_react___default.a.Component {
    getSpotify(token) {
      const spotifyApi = new __WEBPACK_IMPORTED_MODULE_1_spotify_web_api_node___default.a({
        clientId: CLIENT_ID,
        clientSecret: CLIENT_SECRET,
        redirect_uri: REDIRECT_URI
      });
  
      spotifyApi.setAccessToken(token);
      spotifyApi.getPlaylist('stephaniecurran', '7lj1gdwwwccyjEVXiEyIbQ').then(res => {
        const items = res.body.tracks.items;
        const tracks = items.map(x => Object.assign(x.track, { addedBy: x.added_by.id }));
        this.setState({
          playlist: res.body,
          tracks
        });
      }, err => {
        localStorage.removeItem('authToken');
      });
    }
  
    componentDidMount() {
      if (!localStorage || !localStorage.authToken) {
        return;
      }
  
      if (__WEBPACK_IMPORTED_MODULE_5_moment___default.a().diff(__WEBPACK_IMPORTED_MODULE_5_moment___default.a(localStorage.authTime), 'minutes') > 2) {
        localStorage.removeItem('authToken');
      }
  
      this.getSpotify(JSON.parse(localStorage.authToken).access_token);
    }
  
    track(track, idx) {
      const artists = track.artists.map(x => x.name).join(', ');
      const rowStyle = idx % 2 ? __WEBPACK_IMPORTED_MODULE_2__Playlist_css___default.a.even : __WEBPACK_IMPORTED_MODULE_2__Playlist_css___default.a.odd;
      return __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
        'div',
        { className: __WEBPACK_IMPORTED_MODULE_3_classnames___default.a(__WEBPACK_IMPORTED_MODULE_2__Playlist_css___default.a.row, rowStyle), __source: {
            fileName: _jsxFileName,
            lineNumber: 50
          },
          __self: this
        },
        __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
          'div',
          { className: __WEBPACK_IMPORTED_MODULE_3_classnames___default.a(__WEBPACK_IMPORTED_MODULE_2__Playlist_css___default.a.cell, __WEBPACK_IMPORTED_MODULE_2__Playlist_css___default.a.track), __source: {
              fileName: _jsxFileName,
              lineNumber: 51
            },
            __self: this
          },
          track.name
        ),
        __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
          'div',
          { className: __WEBPACK_IMPORTED_MODULE_3_classnames___default.a(__WEBPACK_IMPORTED_MODULE_2__Playlist_css___default.a.cell, __WEBPACK_IMPORTED_MODULE_2__Playlist_css___default.a.artist), __source: {
              fileName: _jsxFileName,
              lineNumber: 54
            },
            __self: this
          },
          artists
        ),
        __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
          'div',
          { className: __WEBPACK_IMPORTED_MODULE_3_classnames___default.a(__WEBPACK_IMPORTED_MODULE_2__Playlist_css___default.a.cell, __WEBPACK_IMPORTED_MODULE_2__Playlist_css___default.a.addedBy), __source: {
              fileName: _jsxFileName,
              lineNumber: 57
            },
            __self: this
          },
          track.addedBy
        ),
        __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
          'div',
          { className: __WEBPACK_IMPORTED_MODULE_2__Playlist_css___default.a.cell, __source: {
              fileName: _jsxFileName,
              lineNumber: 60
            },
            __self: this
          },
          'Votes: 10'
        )
      );
    }
  
    render() {
      const { playlist, tracks } = this.state || {};
      if (!tracks) return __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
        'div',
        {
          __source: {
            fileName: _jsxFileName,
            lineNumber: 69
          },
          __self: this
        },
        'Login to access playlist'
      );
  
      return __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
        'div',
        {
          __source: {
            fileName: _jsxFileName,
            lineNumber: 72
          },
          __self: this
        },
        __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
          'h2',
          {
            __source: {
              fileName: _jsxFileName,
              lineNumber: 73
            },
            __self: this
          },
          playlist.name
        ),
        __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
          'div',
          { className: __WEBPACK_IMPORTED_MODULE_2__Playlist_css___default.a.col, __source: {
              fileName: _jsxFileName,
              lineNumber: 74
            },
            __self: this
          },
          tracks.map(this.track)
        )
      );
    }
  
  }
  
  /* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_4_isomorphic_style_loader_lib_withStyles___default.a(__WEBPACK_IMPORTED_MODULE_2__Playlist_css___default.a)(Playlist));
  
  /***/ })
  
  };
  //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXBkYXRlcy8xLjdjY2VmMDJkMjU4YzUwMzQ0ZTAwLmhvdC11cGRhdGUuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vc3JjL3JvdXRlcy9wbGF5bGlzdC9QbGF5bGlzdC5qcz84MDg0Il0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBSZWFjdCBmcm9tICdyZWFjdCc7XG5pbXBvcnQgU3BvdGlmeVdlYkFwaSBmcm9tICdzcG90aWZ5LXdlYi1hcGktbm9kZSc7XG5pbXBvcnQgcyBmcm9tICcuL1BsYXlsaXN0LmNzcyc7XG5pbXBvcnQgY3ggZnJvbSAnY2xhc3NuYW1lcyc7XG5pbXBvcnQgd2l0aFN0eWxlcyBmcm9tICdpc29tb3JwaGljLXN0eWxlLWxvYWRlci9saWIvd2l0aFN0eWxlcyc7XG5pbXBvcnQgbW9tZW50IGZyb20gJ21vbWVudCc7XG5cbmNvbnN0IENMSUVOVF9JRCA9ICdiOGFlMzYyODZmMWM0ZGIyOGE4YTJiYTM4MGE0ZDhjYyc7XG5jb25zdCBDTElFTlRfU0VDUkVUID0gJzE4Y2ZjNzVlOWY0YjQ3ODVhYzMyNWVhYTM4YTA5NWM5JztcbmNvbnN0IFJFRElSRUNUX1VSSSA9ICdodHRwOi8vbG9jYWxob3N0OjMwMDAvY2FsbGJhY2snO1xuXG5jbGFzcyBQbGF5bGlzdCBleHRlbmRzIFJlYWN0LkNvbXBvbmVudCB7XG4gIGdldFNwb3RpZnkodG9rZW4pe1xuICAgIGNvbnN0IHNwb3RpZnlBcGkgPSBuZXcgU3BvdGlmeVdlYkFwaSh7XG4gICAgICBjb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