mirror of
https://github.com/TeamPiped/Piped.git
synced 2024-08-14 23:57:27 +00:00
cleanup
This commit is contained in:
parent
5650752fcf
commit
de4d8ce350
1 changed files with 17 additions and 17 deletions
|
@ -40,28 +40,28 @@ export default {
|
|||
};
|
||||
},
|
||||
mounted() {
|
||||
if (this.authenticated)
|
||||
this.fetchJson(this.authApiUrl() + "/subscriptions", null, {
|
||||
headers: {
|
||||
Authorization: this.getAuthToken(),
|
||||
},
|
||||
}).then(json => {
|
||||
this.subscriptions = json;
|
||||
this.subscriptions.forEach(subscription => (subscription.subscribed = true));
|
||||
});
|
||||
else {
|
||||
this.fetchJson(this.authApiUrl() + "/subscriptions/unauthenticated", null, {
|
||||
channels: this.getUnauthenticatedChannels(),
|
||||
}).then(json => {
|
||||
this.subscriptions = json;
|
||||
this.subscriptions.forEach(subscription => (subscription.subscribed = true));
|
||||
});
|
||||
}
|
||||
this.fetchSubscriptions().then(json => {
|
||||
this.subscriptions = json;
|
||||
this.subscriptions.forEach(subscription => (subscription.subscribed = true));
|
||||
});
|
||||
},
|
||||
activated() {
|
||||
document.title = "Subscriptions - Piped";
|
||||
},
|
||||
methods: {
|
||||
async fetchSubscriptions() {
|
||||
if (this.authenticated) {
|
||||
return await this.fetchJson(this.authApiUrl() + "/subscriptions", null, {
|
||||
headers: {
|
||||
Authorization: this.getAuthToken(),
|
||||
},
|
||||
});
|
||||
} else {
|
||||
return await this.fetchJson(this.authApiUrl() + "/subscriptions/unauthenticated", null, {
|
||||
channels: this.getUnauthenticatedChannels(),
|
||||
});
|
||||
}
|
||||
},
|
||||
handleButton(subscription) {
|
||||
this.fetchJson(this.authApiUrl() + (subscription.subscribed ? "/unsubscribe" : "/subscribe"), null, {
|
||||
method: "POST",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue