From 3b0f1a7678f182e7da4432063b8edd567eac9d74 Mon Sep 17 00:00:00 2001 From: bopol Date: Sun, 4 Jul 2021 16:44:23 +0200 Subject: [PATCH] Support region for trending --- src/components/TrendingPage.vue | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/components/TrendingPage.vue b/src/components/TrendingPage.vue index a32545d1..5e1fbe49 100644 --- a/src/components/TrendingPage.vue +++ b/src/components/TrendingPage.vue @@ -28,11 +28,17 @@ export default { mounted() { document.title = "Trending - Piped"; - this.fetchTrending().then(videos => (this.videos = videos)); + let region = this.$route.query.region; + + this.fetchTrending(region).then(videos => (this.videos = videos)); }, methods: { - async fetchTrending() { - return await this.fetchJson(Constants.BASE_URL + "/trending"); + async fetchTrending(region) { + let url = Constants.BASE_URL + "/trending"; + if (region) { + url += "?region=" + region; + } + return await this.fetchJson(url); }, }, components: {