Commit 531b6ccb authored by jackie / Andrea Ida Malkah Klaura's avatar jackie / Andrea Ida Malkah Klaura
Browse files

FIX: update playlists table after edit

parent 38fb3e27
Pipeline #384 failed with stages
in 1 minute and 14 seconds
......@@ -788,11 +788,14 @@ export default {
return null
},
// Returns a playlist object from the playlists array, given a playlist ID
getPlaylistById: function (id) {
// Returns a playlist object from the playlists array, given a playlist ID.
// If the mode parameter is used and set to 'index', then the playlists
// index in the playlist array is returned instead of the object
getPlaylistById: function (id, mode) {
for (var i in this.playlists) {
if (this.playlists[i].id === id) {
return this.playlists[i]
if (mode === 'index') { return i }
else { return this.playlists[i] }
}
}
return null
......@@ -944,15 +947,14 @@ export default {
// when updating an existing playlist we use a PUT request and add the id
// of the playlist to the uri
} else if (this.playlistEditor.mode === 'edit') {
uri += '/' + this.playlistEditor.id
var id = this.playlistEditor.id
uri += '/' + id
axios.put(uri, data, {
withCredentials: true,
headers: { 'Authorization': 'Bearer ' + this.$parent.user.access_token }
}).then(response => {
// TODO: seems to be not implemented in the tank yet
// update this as soon as tank has it implemented
//this.playlists.push(response.data)
console.log(response.data)
this.playlists[this.getPlaylistById(id, 'index')] = response.data
this.$refs.playlistsTable.refresh()
}).catch(error => {
console.log('Error: ' + error.response.status + ' ' + error.response.statusText)
console.log(error.response)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment