Thursday 1 June 2017

What does "WebapiError" mean?

I'm working on Spotify Web App that just retrieves KD Rusha Top Albums trying to used Client ID, Artist ID to fetch only KD Rusha top album releases on his Spotify. I'm using an npm package called spotify-web-api-node.

Error Messageenter image description here

import React from 'react';
import SpotifyWebApi from 'spotify-web-api-node';
require('dotenv').config();

// My Steps: //
// GO TO SPOTIFY AND GETTING KD RUSHA TOP ABLUMS lIMIT TO 9 SONGS
// WHEN YOU CLICK ON TOP OF THE ABLUMS A PLAY BUTTON ICON WILL SHOW TO INDICATE THAT YOU CAN PLAY 30 SECONDS OF SONG

const spotifyApi = new SpotifyWebApi({
  clientId : 'here where client id',
  clientSecret : 'here where client secret',
  redirectUri : 'http://www.localhost.com/callback'
});

export default class SpotifyComponent extends React.Component {

  componentDidMount() {
    window.setTimeout(() => {
      this.fetchData();
    }, 3000)
  }

 fetchData() {//Its Fetch Artist Albums The Spotify Date
   spotifyApi.getArtistAlbums('5JLWikpo5DFPqvIRi43v5y', {limit: 9})
     .then(function(data) {
       return data.body.albums.map(function(a) { return a.id; });
     })
     .then(function(albums) {
       return spotifyApi.getAlbums(albums);
     }).then(function(data) {
       console.log(data.body);
   });
 }

  render(){
    return(
      <div className='spoify-container'>
        <img src="{image.albums}" alt="kdrusha-albums" />
      </div>
    );
  }
}



via Brandon Powell

No comments:

Post a Comment