load first pages serial instead parallel
This commit is contained in:
parent
836c46db32
commit
740152500e
@ -32,12 +32,15 @@ export default {
|
|||||||
|
|
||||||
},
|
},
|
||||||
loadAlbums(context, force) {
|
loadAlbums(context, force) {
|
||||||
|
return new Promise((resolve) => {
|
||||||
if ((!context.state.eos || force) && !context.state.loading) {
|
if ((!context.state.eos || force) && !context.state.loading) {
|
||||||
context.state.loading = true;
|
context.state.loading = true;
|
||||||
axios.get(context.rootGetters.server + "/api/albums/page/" + context.state.page++, context.rootGetters.headers).then((res) => {
|
axios.get(context.rootGetters.server + "/api/albums/page/" + context.state.page++, context.rootGetters.headers).then((res) => {
|
||||||
context.commit("setAlbums", res.data);
|
context.commit("setAlbums", res.data);
|
||||||
|
resolve(res.data);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
loadFavourites(context) {
|
loadFavourites(context) {
|
||||||
axios.get(context.rootGetters.server + "/api/albums/favourites", context.rootGetters.headers).then(res => {
|
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 => {
|
axios.post(context.rootGetters.server + "/api/albums/" + album._id + "/share", {}, context.rootGetters.headers).then(res => {
|
||||||
album.share = res.data;
|
album.share = res.data;
|
||||||
resolve();
|
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 });
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -13,12 +13,15 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
loadArtists(context, force) {
|
loadArtists(context, force) {
|
||||||
|
return new Promise((resolve) => {
|
||||||
if ((!context.state.eos || force) && !context.state.loading) {
|
if ((!context.state.eos || force) && !context.state.loading) {
|
||||||
context.state.loading = true;
|
context.state.loading = true;
|
||||||
axios.get(context.rootGetters.server + "/api/artists/page/" + context.state.page++, context.rootGetters.headers).then((res) => {
|
axios.get(context.rootGetters.server + "/api/artists/page/" + context.state.page++, context.rootGetters.headers).then((res) => {
|
||||||
context.commit("setArtists", res.data);
|
context.commit("setArtists", res.data);
|
||||||
|
resolve(res.data);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
loadArtist(context, id) {
|
loadArtist(context, id) {
|
||||||
context.state.loading = true;
|
context.state.loading = true;
|
||||||
|
@ -13,12 +13,15 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
loadBoxes(context, force) {
|
loadBoxes(context, force) {
|
||||||
|
return new Promise((resolve) => {
|
||||||
if ((!context.state.eos || force) && !context.state.loading) {
|
if ((!context.state.eos || force) && !context.state.loading) {
|
||||||
context.state.loading = true;
|
context.state.loading = true;
|
||||||
axios.get(context.rootGetters.server + "/api/boxes/page/" + context.state.page++, context.rootGetters.headers).then((res) => {
|
axios.get(context.rootGetters.server + "/api/boxes/page/" + context.state.page++, context.rootGetters.headers).then((res) => {
|
||||||
context.commit("setBoxes", res.data);
|
context.commit("setBoxes", res.data);
|
||||||
|
resolve(res.data);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
loadFavourites(context) {
|
loadFavourites(context) {
|
||||||
axios.get(context.rootGetters.server + "/api/boxes/favourites", context.rootGetters.headers).then(res => {
|
axios.get(context.rootGetters.server + "/api/boxes/favourites", context.rootGetters.headers).then(res => {
|
||||||
|
@ -106,8 +106,11 @@ export default {
|
|||||||
this.$store.dispatch("videos/loadMostViewed");
|
this.$store.dispatch("videos/loadMostViewed");
|
||||||
if (this.randomCovers.length == 0) {
|
if (this.randomCovers.length == 0) {
|
||||||
this.$store.dispatch("albums/loadRandomCovers", 60);
|
this.$store.dispatch("albums/loadRandomCovers", 60);
|
||||||
this.$store.dispatch("albums/loadAlbums", true);
|
this.$store.dispatch("albums/loadAlbums", true).then(() => {
|
||||||
this.$store.dispatch("artists/loadArtists", true);
|
this.$store.dispatch("artists/loadArtists", true).then(() => {
|
||||||
|
this.$store.dispatch("boxes/loadBoxes", true);
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
loadNextPage() {
|
loadNextPage() {
|
||||||
|
Loading…
Reference in New Issue
Block a user