Merge pull request #1274 from Bnyro/unauth-subs

fix unauthenticated subscribe status
This commit is contained in:
Kavin 2022-08-02 15:05:43 +05:30 committed by GitHub
commit c37b5390cf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 4 deletions

View file

@ -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);
}
});

View file

@ -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",