add date method and link to external paper

This commit is contained in:
Vri 🌈 2023-06-17 15:12:29 +02:00
parent c88fb4d28d
commit f0164afe9f
Signed by: vrifox
GPG key ID: D40098E5B60B2197

View file

@ -48,13 +48,17 @@ export default {
}) })
} }
return filteredPapers return filteredPapers
} },
}, },
methods: { methods: {
async fetchData() { async fetchData() {
this.papers = await (await fetch(this.apiUri)).json() this.papers = await (await fetch(this.apiUri)).json()
}, },
openPaper() {} openPaper() {}
date(paperDate: String) {
const date = new Date(paperDate)
return new Intl.DateTimeFormat('de-DE', { dateStyle: 'full' }).format(date)
},
}, },
} }
</script> </script>
@ -74,7 +78,7 @@ export default {
@click.prevent="openPaper()" @click.prevent="openPaper()"
> >
<h4 class="text-xl">{{ paper.name }}</h4> <h4 class="text-xl">{{ paper.name }}</h4>
<p>{{ paper.published_at }}: {{ paper.paper_type}} von {{ paper.originator }}</p> <p>{{ date(paper.published_at) }}: <a :href="paper.url" class="text-secondary-button-500">{{ paper.paper_type}} von {{ paper.originator }}</a></p>
</article> </article>
</li> </li>
</ul> </ul>