catch vuex action errors

This commit is contained in:
Thomas Amland 2020-08-05 11:30:30 +02:00
parent e7f4c9af19
commit 74bee52d4b
2 changed files with 5 additions and 5 deletions

View File

@ -47,12 +47,11 @@ export default Vue.extend({
}, },
methods: { methods: {
remove(index: number) { remove(index: number) {
console.log("remove: " + index)
this.$api.removeFromPlaylist(this.id, index.toString());
this.playlist.tracks.splice(index, 1); this.playlist.tracks.splice(index, 1);
return this.$api.removeFromPlaylist(this.id, index.toString());
}, },
deletePlaylist() { deletePlaylist() {
this.$store.dispatch("deletePlaylist", this.id).then(() => { return this.$store.dispatch("deletePlaylist", this.id).then(() => {
this.$router.replace({name: "playlists"}) this.$router.replace({name: "playlists"})
}) })
}, },

View File

@ -53,15 +53,16 @@ export default Vue.extend({
}, },
methods: { methods: {
createPlaylist() { createPlaylist() {
this.$store.dispatch("createPlaylist", this.playlistName); const name = this.playlistName;
this.playlistName = ""; this.playlistName = "";
this.showModal = false; this.showModal = false;
return this.$store.dispatch("createPlaylist", name);
}, },
onDrop(playlistId: string, event: any) { onDrop(playlistId: string, event: any) {
console.log("onDrop") console.log("onDrop")
event.preventDefault(); event.preventDefault();
const trackId = event.dataTransfer.getData("id"); const trackId = event.dataTransfer.getData("id");
this.$store.dispatch("addTrackToPlaylist", { playlistId, trackId }) return this.$store.dispatch("addTrackToPlaylist", { playlistId, trackId })
}, },
onDragover(event: any) { onDragover(event: any) {
console.log("onDragover") console.log("onDragover")