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() {
|
mounted() {
|
||||||
if (this.authenticated)
|
this.fetchSubscriptions().then(json => {
|
||||||
this.fetchJson(this.authApiUrl() + "/subscriptions", null, {
|
|
||||||
headers: {
|
|
||||||
Authorization: this.getAuthToken(),
|
|
||||||
},
|
|
||||||
}).then(json => {
|
|
||||||
this.subscriptions = json;
|
this.subscriptions = json;
|
||||||
this.subscriptions.forEach(subscription => (subscription.subscribed = true));
|
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));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
activated() {
|
activated() {
|
||||||
document.title = "Subscriptions - Piped";
|
document.title = "Subscriptions - Piped";
|
||||||
},
|
},
|
||||||
methods: {
|
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) {
|
handleButton(subscription) {
|
||||||
this.fetchJson(this.authApiUrl() + (subscription.subscribed ? "/unsubscribe" : "/subscribe"), null, {
|
this.fetchJson(this.authApiUrl() + (subscription.subscribed ? "/unsubscribe" : "/subscribe"), null, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue