load first pages serial instead parallel
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing

This commit is contained in:
Artem Anufrij
2023-10-05 13:31:46 +02:00
parent 836c46db32
commit 740152500e
4 changed files with 33 additions and 21 deletions

View File

@@ -32,12 +32,15 @@ export default {
},
loadAlbums(context, force) {
if ((!context.state.eos || force) && !context.state.loading) {
context.state.loading = true;
axios.get(context.rootGetters.server + "/api/albums/page/" + context.state.page++, context.rootGetters.headers).then((res) => {
context.commit("setAlbums", res.data);
});
}
return new Promise((resolve) => {
if ((!context.state.eos || force) && !context.state.loading) {
context.state.loading = true;
axios.get(context.rootGetters.server + "/api/albums/page/" + context.state.page++, context.rootGetters.headers).then((res) => {
context.commit("setAlbums", res.data);
resolve(res.data);
});
}
});
},
loadFavourites(context) {
axios.get(context.rootGetters.server + "/api/albums/favourites", context.rootGetters.headers).then(res => {
@@ -165,7 +168,7 @@ export default {
axios.post(context.rootGetters.server + "/api/albums/" + album._id + "/share", {}, context.rootGetters.headers).then(res => {
album.share = res.data;
resolve();
context.dispatch("addPoUp", { title: "Share successful", message: "Url was copied into your clipboard", type: "success", icon:"share" }, { root: true });
context.dispatch("addPoUp", { title: "Share successful", message: "Url was copied into your clipboard", type: "success", icon: "share" }, { root: true });
});
});
},