- {{ playlist.name }}
+
+ {{ playlist.name }}
-
+
{{ playlist.uploader }}
@@ -28,7 +29,11 @@
class="uk-link-muted uk-text-justify"
v-bind:to="item.url || '/'"
>
-
+
{{ item.title }}
@@ -67,11 +72,9 @@ export default {
},
methods: {
async fetchPlaylist() {
- return await (
- await fetch(
- Constants.BASE_URL + "/playlists/" + this.$route.query.list
- )
- ).json();
+ return await await this.fetchJson(
+ Constants.BASE_URL + "/playlists/" + this.$route.query.list
+ );
},
async getPlaylistData() {
this.fetchPlaylist()
@@ -86,24 +89,20 @@ export default {
document.body.offsetHeight - window.innerHeight
) {
this.loading = true;
- fetch(
+ this.fetchJson(
Constants.BASE_URL +
"/nextpage/playlists/" +
this.$route.query.list +
"?url=" +
encodeURIComponent(this.playlist.nextpage)
- )
- .then(body => body.json())
- .then(json => {
- this.playlist.relatedStreams.concat(
- json.relatedStreams
- );
- this.playlist.nextpage = json.nextpage;
- this.loading = false;
- json.relatedStreams.map(stream =>
- this.playlist.relatedStreams.push(stream)
- );
- });
+ ).then(json => {
+ this.playlist.relatedStreams.concat(json.relatedStreams);
+ this.playlist.nextpage = json.nextpage;
+ this.loading = false;
+ json.relatedStreams.map(stream =>
+ this.playlist.relatedStreams.push(stream)
+ );
+ });
}
}
}
diff --git a/src/components/SearchResults.vue b/src/components/SearchResults.vue
index b415b010..ca3d1cec 100644
--- a/src/components/SearchResults.vue
+++ b/src/components/SearchResults.vue
@@ -15,7 +15,11 @@
class="uk-text-emphasis"
v-bind:to="result.url || '/'"
>
-
+
{{ result.name }}
{{ result.uploaderName }}
{{ result.duration ? timeFormat(result.duration) : "" }}
+
+ {{ "1/1/2020" }}
{{ result.views }} views
@@ -57,13 +63,11 @@ export default {
},
methods: {
async fetchResults() {
- return await (
- await fetch(
- Constants.BASE_URL +
- "/search?q=" +
- encodeURIComponent(this.$route.query.search_query)
- )
- ).json();
+ return await await this.fetchJson(
+ Constants.BASE_URL +
+ "/search?q=" +
+ encodeURIComponent(this.$route.query.search_query)
+ );
},
async updateResults() {
document.title = this.$route.query.search_query + " - Piped";
@@ -78,7 +82,7 @@ export default {
document.body.offsetHeight - window.innerHeight
) {
this.loading = true;
- fetch(
+ this.fetchJson(
Constants.BASE_URL +
"/nextpage/search" +
"?url=" +
@@ -87,16 +91,12 @@ export default {
encodeURIComponent(this.results.id) +
"&q=" +
encodeURIComponent(this.$route.query.search_query)
- )
- .then(body => body.json())
- .then(json => {
- this.results.nextpage = json.nextpage;
- this.results.id = json.id;
- this.loading = false;
- json.items.map(stream =>
- this.results.items.push(stream)
- );
- });
+ ).then(json => {
+ this.results.nextpage = json.nextpage;
+ this.results.id = json.id;
+ this.loading = false;
+ json.items.map(stream => this.results.items.push(stream));
+ });
}
}
}
diff --git a/src/components/TrendingPage.vue b/src/components/TrendingPage.vue
index 3cf223a2..003114c3 100644
--- a/src/components/TrendingPage.vue
+++ b/src/components/TrendingPage.vue
@@ -15,7 +15,11 @@
class="uk-text-emphasis"
v-bind:to="video.url || '/'"
>
-
+
{{ video.title }}
{{ video.uploaderName }}
- {{ timeFormat(video.duration) }}
-
+
{{ video.views }} views
+
+ {{ video.uploadedDate }}
+
+
+ {{ timeFormat(video.duration) }}
@@ -50,7 +58,7 @@ export default {
},
methods: {
async fetchTrending() {
- return await (await fetch(Constants.BASE_URL + "/trending")).json();
+ return await this.fetchJson(Constants.BASE_URL + "/trending");
}
}
};
diff --git a/src/components/WatchVideo.vue b/src/components/WatchVideo.vue
index e92519c0..541adcca 100644
--- a/src/components/WatchVideo.vue
+++ b/src/components/WatchVideo.vue
@@ -1,13 +1,9 @@