Skip to content

Commit

Permalink
fix: 🐛 Fixed spotify web api calls
Browse files Browse the repository at this point in the history
  • Loading branch information
EricLambrecht committed Aug 23, 2018
1 parent 4437d2b commit d4f76d9
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/components/SpotifyPlaylistSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,20 @@ export default {
computed: {
playlistURIData() {
// example: spotify:user:1127316932:playlist:0pLfNXXyU21MWIv0tP3hwH
const search = this.playlistURI.match(/.*user:([\d]+):playlist:(.+)/i);
const search = this.playlistURI.match(/.*user:([^\s]+):playlist:([^\s]+)/i);
if (search === null) {
return null;
}
return {
userId: search[1] ? search[1] : "",
id: search[2] ? search[2] : "",
userId: search[1],
id: search[2],
};
}
},
methods: {
getTracks(offset = 0, limit = 0) {
// Do we have all tracks?
return s.getPlaylistTracks(this.playlistURIData.userId, this.playlistURIData.id, {
return s.getPlaylistTracks(this.playlistURIData.id, {
limit: limit,
offset: offset
}).then((tracks) => {
Expand All @@ -52,7 +55,7 @@ export default {
},
fetchPlaylist () {
console.log('this.playlistURIData', this.playlistURIData);
s.getPlaylist(this.playlistURIData.userId, this.playlistURIData.id)
s.getPlaylist(this.playlistURIData.id)
.then((data) => {
// Do we have all tracks?
Expand All @@ -71,6 +74,7 @@ export default {
this.$emit('select', data);
}
}, (err) => {
console.log('err', err);
const res = JSON.parse(err.response);
// See if access token expired
Expand Down

0 comments on commit d4f76d9

Please sign in to comment.