liftedpixel / jammming

a Codecademy React project
http://jammmmmmmmmmmming.surge.sh
0 stars 0 forks source link

Spotify module #2

Open ghost opened 6 years ago

ghost commented 6 years ago

https://github.com/liftedpixel/jammming/blob/master/src/components/Spotify/Spotify.js

Nicely done, you've clearly got a solid understanding of fetch's Promise-based API and have made good use of ES6's template strings throughout your module 👍

As a challenge to yourself, can you refactor this module more concisely using async/await? Do you have any opportunities to declare other variables, like the headers object or the API URL, outside of Spotify object so that you don't repeat code?

liftedpixel commented 6 years ago

I've moved the headers and the first part of the api URL (api.spotify.com/v1) out of the object. I'm not sure I understand what you mean reguarding async and await. I get how to send a message and get and handle a response, but I'm not sure about how to format it differently so that it's specifically using async.