restore progress after reloading the page (F5)
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
fa75ba4ad7
commit
37919998dd
@ -216,8 +216,13 @@ export default {
|
|||||||
this.$store.dispatch("albums/shareDisable", this.selectedAlbum);
|
this.$store.dispatch("albums/shareDisable", this.selectedAlbum);
|
||||||
},
|
},
|
||||||
loadUserProgress() {
|
loadUserProgress() {
|
||||||
if (this.selectedTrack.parent._id != this.selectedAlbum._id)
|
if (this.selectedTrack.parent._id != this.selectedAlbum._id) {
|
||||||
this.$store.dispatch("user/getProgress", this.selectedAlbum);
|
this.$store
|
||||||
|
.dispatch("user/getProgress", this.selectedAlbum)
|
||||||
|
.then(() => {
|
||||||
|
this.gotoTrack();
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -310,7 +315,6 @@ export default {
|
|||||||
window.addEventListener("keydown", this.keydownListener);
|
window.addEventListener("keydown", this.keydownListener);
|
||||||
}
|
}
|
||||||
this.loadUserProgress();
|
this.loadUserProgress();
|
||||||
this.gotoTrack();
|
|
||||||
} else {
|
} else {
|
||||||
if (this.$refs.dialogWindow.visible) {
|
if (this.$refs.dialogWindow.visible) {
|
||||||
this.$refs.dialogWindow.close();
|
this.$refs.dialogWindow.close();
|
||||||
|
@ -154,8 +154,13 @@ export default {
|
|||||||
this.$store.dispatch("artists/uploadNewCover", this.selectedArtist);
|
this.$store.dispatch("artists/uploadNewCover", this.selectedArtist);
|
||||||
},
|
},
|
||||||
loadUserProgress() {
|
loadUserProgress() {
|
||||||
if (!this.isPlaying || this.selectedTrack.parent.parent._id != this.selectedArtist._id)
|
if (!this.isPlaying || this.selectedTrack.parent.parent && this.selectedTrack.parent.parent._id != this.selectedArtist._id) {
|
||||||
this.$store.dispatch("user/getProgress", this.selectedArtist);
|
this.$store.dispatch("user/getProgress", this.selectedArtist).then(() => {
|
||||||
|
this.gotoTrack();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.gotoTrack();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -231,7 +236,6 @@ export default {
|
|||||||
window.addEventListener("keydown", this.keydownListener);
|
window.addEventListener("keydown", this.keydownListener);
|
||||||
}
|
}
|
||||||
this.loadUserProgress();
|
this.loadUserProgress();
|
||||||
this.gotoTrack();
|
|
||||||
} else {
|
} else {
|
||||||
if (this.$refs.dialogWindow.visible) {
|
if (this.$refs.dialogWindow.visible) {
|
||||||
this.$refs.dialogWindow.close();
|
this.$refs.dialogWindow.close();
|
||||||
|
@ -88,14 +88,17 @@ export default {
|
|||||||
.post(context.rootGetters.server + "/api/user/progress", item, context.rootGetters.headers);
|
.post(context.rootGetters.server + "/api/user/progress", item, context.rootGetters.headers);
|
||||||
},
|
},
|
||||||
getProgress(context, parent) {
|
getProgress(context, parent) {
|
||||||
|
return new Promise((resolve) => {
|
||||||
if (context.state._id == -1) {
|
if (context.state._id == -1) {
|
||||||
return;
|
resolve();
|
||||||
}
|
} else {
|
||||||
|
|
||||||
axios
|
axios
|
||||||
.get(context.rootGetters.server + "/api/user/progress/" + parent._id, context.rootGetters.headers)
|
.get(context.rootGetters.server + "/api/user/progress/" + parent._id, context.rootGetters.headers)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
parent.progress = res.data;
|
parent.progress = res.data;
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
resetProgress(context, parentId) {
|
resetProgress(context, parentId) {
|
||||||
|
Loading…
Reference in New Issue
Block a user