From 587239b799b7043ec497b874316c04169650ebc8 Mon Sep 17 00:00:00 2001 From: KevinMidboe Date: Sun, 11 Oct 2020 17:56:59 +0200 Subject: [PATCH] All wines simplified. Refactor script and template. --- src/components/AllWinesPage.vue | 193 ++++++++++++++------------------ 1 file changed, 82 insertions(+), 111 deletions(-) diff --git a/src/components/AllWinesPage.vue b/src/components/AllWinesPage.vue index f042fbd..24cad15 100644 --- a/src/components/AllWinesPage.vue +++ b/src/components/AllWinesPage.vue @@ -1,26 +1,32 @@ @@ -30,6 +36,7 @@ import { page, event } from "vue-analytics"; import Banner from "@/ui/Banner"; import Wine from "@/ui/Wine"; import { overallWineStatistics } from "@/api"; +import { dateString } from "@/utils"; export default { components: { @@ -41,133 +48,97 @@ export default { wines: [] }; }, + methods: { + winDateUrl(date) { + const timestamp = new Date(date).getTime(); + return `/history/${timestamp}` + }, + dateString: dateString + }, async mounted() { - const wines = await overallWineStatistics(); - this.wines = wines.sort((a, b) => - a.rating > b.rating ? -1 : 1 - ); + this.wines = await overallWineStatistics(); } };