mirror of
https://github.com/TeamPiped/Piped.git
synced 2025-01-11 07:17:00 +00:00
proper nextpage implementation
This commit is contained in:
parent
40417bbdde
commit
94def0723d
@ -139,16 +139,33 @@ export default {
|
|||||||
if (this.loading || !this.channel || !this.channel.nextpage) return;
|
if (this.loading || !this.channel || !this.channel.nextpage) return;
|
||||||
if (window.innerHeight + window.scrollY >= document.body.offsetHeight - window.innerHeight) {
|
if (window.innerHeight + window.scrollY >= document.body.offsetHeight - window.innerHeight) {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
this.fetchJson(this.apiUrl() + "/nextpage/channel/" + this.channel.id, {
|
if (this.selectedTab == 0) {
|
||||||
nextpage: this.channel.nextpage,
|
this.fetchChannelNextPage();
|
||||||
}).then(json => {
|
} else {
|
||||||
this.channel.nextpage = json.nextpage;
|
this.fetchChannelTabNextPage();
|
||||||
this.loading = false;
|
}
|
||||||
this.updateWatched(json.relatedStreams);
|
|
||||||
json.relatedStreams.map(stream => this.contentItems.push(stream));
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
fetchChannelNextPage() {
|
||||||
|
this.fetchJson(this.apiUrl() + "/nextpage/channel/" + this.channel.id, {
|
||||||
|
nextpage: this.channel.nextpage,
|
||||||
|
}).then(json => {
|
||||||
|
this.channel.nextpage = json.nextpage;
|
||||||
|
this.loading = false;
|
||||||
|
this.updateWatched(json.relatedStreams);
|
||||||
|
json.relatedStreams.map(stream => this.contentItems.push(stream));
|
||||||
|
});
|
||||||
|
},
|
||||||
|
fetchChannelTabNextPage() {
|
||||||
|
this.fetchJson(this.apiUrl() + "/channels/tabs", {
|
||||||
|
data: this.tabs[this.selectedTab].data,
|
||||||
|
nextpage: this.tabNextPage,
|
||||||
|
}).then(json => {
|
||||||
|
this.tabNextPage = json.nextpage;
|
||||||
|
this.loading = false;
|
||||||
|
json.content.map(item => this.contentItems.push(item));
|
||||||
|
});
|
||||||
|
},
|
||||||
subscribeHandler() {
|
subscribeHandler() {
|
||||||
if (this.authenticated) {
|
if (this.authenticated) {
|
||||||
this.fetchJson(this.authApiUrl() + (this.subscribed ? "/unsubscribe" : "/subscribe"), null, {
|
this.fetchJson(this.authApiUrl() + (this.subscribed ? "/unsubscribe" : "/subscribe"), null, {
|
||||||
@ -185,6 +202,7 @@ export default {
|
|||||||
return translatedTabName;
|
return translatedTabName;
|
||||||
},
|
},
|
||||||
loadTab(index) {
|
loadTab(index) {
|
||||||
|
this.selectedTab = index;
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
this.contentItems = this.channel.relatedStreams;
|
this.contentItems = this.channel.relatedStreams;
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user