From 08f9ba6bf7012862526e3bc1bc8ec84ba41c3c56 Mon Sep 17 00:00:00 2001 From: ManjaroOne666 Date: Tue, 12 Feb 2019 11:45:22 +0000 Subject: [PATCH] home page api calls --- TODO.md | 23 +++++++++++++++++++++++ pages/index.vue | 31 ++++++------------------------- 2 files changed, 29 insertions(+), 25 deletions(-) diff --git a/TODO.md b/TODO.md index 25cb51a..e744099 100644 --- a/TODO.md +++ b/TODO.md @@ -5,6 +5,7 @@ * Galleries - sort thumbs by sort_order * API * mailer +* remove testing/dev mode or whatever its called from axios in nuxt.config.js ## Maybes * gallery page - featured images in same style as on services page with the @@ -18,3 +19,25 @@ * galleries - click on thumb, click on different gallery, click on original gallery and the thumb list doesn't scroll to correct position to show thumb 0, it is still showing the thumb that was clicked on first + +## Data for Backend +```javascript +//home + bgImages: [ + 'https://marcleopold.isnet.uk/wp-content/uploads/2017/07/slider.jpg', + 'https://marcleopold.isnet.uk/wp-content/uploads/2017/07/slider-2.jpeg', + 'https://marcleopold.isnet.uk/wp-content/uploads/2017/07/slider-3.jpeg', + 'https://marcleopold.isnet.uk/wp-content/uploads/2017/07/4-edit-3.jpg', + 'https://marcleopold.isnet.uk/wp-content/uploads/2017/07/4-edit.jpg', + 'https://marcleopold.isnet.uk/wp-content/uploads/2017/07/image-1.png', + 'https://marcleopold.isnet.uk/wp-content/uploads/2017/07/slider-4.jpeg', + ], + taglines: [ + 'the essence of the image', + 'an image of the essential', + 'a solitary instance', + 'an eternal instance', + 'a fleeting eternity', + 'I imagine myself', + ], +``` diff --git a/pages/index.vue b/pages/index.vue index 6632b12..57da690 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -15,7 +15,7 @@

- {{ taglines[currentTaglineIndex] }} + {{ tagline }}

@@ -51,8 +51,8 @@ export default { return url }, - tagLine () { - return this.currentTaglineIndex > -1 ? this.taglines[this.currentTaglineIndex] : '' + tagline () { + return this.currentTaglineIndex > -1 ? this.taglines[this.currentTaglineIndex].text : '' } }, @@ -74,28 +74,9 @@ export default { } }, - asyncData({ store }) { - return new Promise ((resolve, reject) => { - resolve({ - bgImages: [ - 'https://marcleopold.isnet.uk/wp-content/uploads/2017/07/slider.jpg', - 'https://marcleopold.isnet.uk/wp-content/uploads/2017/07/slider-2.jpeg', - 'https://marcleopold.isnet.uk/wp-content/uploads/2017/07/slider-3.jpeg', - 'https://marcleopold.isnet.uk/wp-content/uploads/2017/07/4-edit-3.jpg', - 'https://marcleopold.isnet.uk/wp-content/uploads/2017/07/4-edit.jpg', - 'https://marcleopold.isnet.uk/wp-content/uploads/2017/07/image-1.png', - 'https://marcleopold.isnet.uk/wp-content/uploads/2017/07/slider-4.jpeg', - ], - taglines: [ - 'the essence of the image', - 'an image of the essential', - 'a solitary instance', - 'an eternal instance', - 'a fleeting eternity', - 'I imagine myself', - ], - }) - }) + async asyncData({ $axios }) { + let { bgImages, taglines } = await $axios.$get('/api/v1/home') + return { bgImages, taglines} }, methods: {