restore progress after reloading the page (F5)
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Artem Anufrij
2023-09-19 17:40:18 +02:00
parent fa75ba4ad7
commit 37919998dd
3 changed files with 26 additions and 15 deletions

View File

@@ -88,15 +88,18 @@ export default {
.post(context.rootGetters.server + "/api/user/progress", item, context.rootGetters.headers);
},
getProgress(context, parent) {
if (context.state._id == -1) {
return;
}
axios
.get(context.rootGetters.server + "/api/user/progress/" + parent._id, context.rootGetters.headers)
.then((res) => {
parent.progress = res.data;
});
return new Promise((resolve) => {
if (context.state._id == -1) {
resolve();
} else {
axios
.get(context.rootGetters.server + "/api/user/progress/" + parent._id, context.rootGetters.headers)
.then((res) => {
parent.progress = res.data;
resolve();
});
}
});
},
resetProgress(context, parentId) {
if (context.state._id == -1) {