From a0109e910a10b41ff9cfbef1a4621e13addc98c9 Mon Sep 17 00:00:00 2001 From: Bnyro Date: Tue, 2 Aug 2022 10:41:35 +0200 Subject: [PATCH] fix unauthenticated subscribe status --- src/components/ChannelPage.vue | 10 +++++++--- src/components/WatchVideo.vue | 5 ++++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/components/ChannelPage.vue b/src/components/ChannelPage.vue index 42dceb4d..aceff744 100644 --- a/src/components/ChannelPage.vue +++ b/src/components/ChannelPage.vue @@ -49,7 +49,7 @@ export default { data() { return { channel: null, - subscribed: this.authenticated ? false : this.isSubscribedLocally(this.channelId), + subscribed: false, }; }, mounted() { @@ -68,7 +68,11 @@ export default { }, methods: { async fetchSubscribedStatus() { - if (!this.channelId || !this.authenticated) return; + if (!this.channel.id) return; + if (!this.authenticated) { + this.subscribed = this.isSubscribedLocally(this.channel.id); + return; + } this.fetchJson( this.authApiUrl() + "/subscribed", @@ -94,7 +98,7 @@ export default { .then(() => { if (!this.channel.error) { document.title = this.channel.name + " - Piped"; - if (this.authenticated) this.fetchSubscribedStatus(); + this.fetchSubscribedStatus(); this.updateWatched(this.channel.relatedStreams); } }); diff --git a/src/components/WatchVideo.vue b/src/components/WatchVideo.vue index deb65dae..d6a46c89 100644 --- a/src/components/WatchVideo.vue +++ b/src/components/WatchVideo.vue @@ -427,7 +427,10 @@ export default { }, async fetchSubscribedStatus() { if (!this.channelId) return; - if (!this.authenticated) this.subscribed = this.isSubscribedLocally(this.channelId); + if (!this.authenticated) { + this.subscribed = this.isSubscribedLocally(this.channelId); + return; + } this.fetchJson( this.authApiUrl() + "/subscribed",