Support region for trending (#239)

* Support region for trending

* Handle parameters with mixin.

Co-authored-by: FireMasterK <20838718+FireMasterK@users.noreply.github.com>
This commit is contained in:
bopol 2021-07-04 19:53:36 +02:00 committed by GitHub
parent 192c2b82bb
commit ffec9d992a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -28,11 +28,15 @@ 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) {
return await this.fetchJson(Constants.BASE_URL + "/trending", {
region: region || "US",
});
},
},
components: {