Skip to content

Commit

Permalink
Merge pull request #54 from casper-network/podcast-sorting
Browse files Browse the repository at this point in the history
MODIFIED: sort podcasts by release date
  • Loading branch information
sd-ditoy authored Sep 5, 2023
2 parents f12418f + 23b4442 commit 5584a12
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/components/blocks/PodcastList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -147,16 +147,15 @@ export default {
const locale = Intl.getCanonicalLocales(this.$i18n.locale);
const { data } = await this.$d.api.get(`/podcasts?fields[]=url&fields[]=image&fields[]=release_date&fields[]=content.title,content.description&fields[]=status&filter[status][_eq]=published&filter[content][languages_code][_eq]=${locale}&limit=-1`);
this.podcasts = (data || []).map((o) => ({
const podcasts = (data || []).map((o) => ({
image: `${API_URL}/assets/${o.image}`,
release_date: o.release_date,
url: o.url,
title: (o.content[0] || {}).title,
description: (o.content[0] || {}).description,
readmore: false,
}));
console.log(this.services);
this.podcasts = podcasts.sort((a, b) => new Date(b.release_date) - new Date(a.release_date));
},
// beforeUpdate() {},
// updated() {},
Expand Down

0 comments on commit 5584a12

Please sign in to comment.