axios and proxy modules

This commit is contained in:
ManjaroOne666 2019-02-06 12:45:22 +00:00
parent b7371c4e35
commit 42f76f614c
5 changed files with 24 additions and 86 deletions

View File

@ -1,4 +1,6 @@
## TODO
* Galleries - title not distinguishable on light images
* Galleries - navigatin icons not obvious enough with light background thumbs
* API
* mailer

View File

@ -80,14 +80,21 @@ module.exports = {
[
'@/assets/scss/_globals.scss'
]
]
],
'@nuxtjs/proxy',
],
/*
** Axios module configuration
*/
axios: {
// See https://github.com/nuxt-community/axios-module#options
proxy: true,
baseURL: 'http://192.168.0.5:3003',
},
proxy: {
'/api/v1/': 'http://192.168.0.5:8101'
},
/*

View File

@ -14,6 +14,7 @@
},
"dependencies": {
"@nuxtjs/axios": "^5.3.6",
"@nuxtjs/proxy": "^1.3.1",
"cross-env": "^5.2.0",
"nuxt": "^2.0.0",
"nuxt-buefy": "^0.2.1",

View File

@ -1,5 +1,5 @@
<template>
<GalleryPage :galleries="galleries">
<GalleryPage v-if="galleries" :galleries="galleries">
</GalleryPage>
</template>
@ -13,6 +13,12 @@ export default {
GalleryPage
},
data () {
return {
galleries: false,
}
},
head () {
return {
title: 'My Galleries',
@ -24,89 +30,11 @@ export default {
}
},
asyncData () {
return new Promise((resolve, reject) => {
resolve({
galleries: [
{ title: 'Portraits',
id: 0,
featuredImage: 'https://marcleopold.isnet.uk/wp-content/uploads/2017/07/portraits-4-600x400.jpeg',
images: [
{ id: 1, thumbUrl: 'https://marcleopold.isnet.uk/wp-content/uploads/2017/07/portraits-4-600x400.jpeg', url: 'https://marcleopold.isnet.uk/wp-content/uploads/2017/07/portraits-4-1800x1200.jpeg' },
{ id: 2, thumbUrl: 'https://marcleopold.isnet.uk/wp-content/uploads/2017/07/portraits-3-600x400.jpeg', url: 'https://marcleopold.isnet.uk/wp-content/uploads/2017/07/portraits-3-1800x1200.jpeg' },
{ id: 3, thumbUrl: 'https://marcleopold.isnet.uk/wp-content/uploads/2017/07/portraits-2-480x600.jpg', url: 'https://marcleopold.isnet.uk/wp-content/uploads/2017/07/portraits-2-1800x2250.jpg' },
{ id: 7, thumbUrl: 'https://marcleopold.isnet.uk/wp-content/uploads/2017/07/portraits-8-390x600.jpeg', url: 'https://marcleopold.isnet.uk/wp-content/uploads/2017/07/portraits-8-1560x2400.jpeg' }
]
async asyncData ({ $axios }) {
// TOOD catch errors
let { galleries } = await $axios.$get('/api/v1/galleries')
return { galleries }
},
{ title: 'Flowers',
id: 2,
featuredImage: 'https://marcleopold.isnet.uk/wp-content/uploads/2017/07/flowers-5-600x402.jpeg',
images: [
{ id: 4, thumbUrl: 'https://via.placeholder.com/400x300/ff0000/ffffff', url: 'https://via.placeholder.com/1920x1080/ff0000/ffffff?text=One0' },
{ id: 5, thumbUrl: 'https://via.placeholder.com/400x300/00ff00/ffffff', url: 'https://via.placeholder.com/1920x1080/00ff00/ffffff?text=One1' },
{ id: 6, thumbUrl: 'https://via.placeholder.com/400x300/0000ff/ffffff', url: 'https://via.placeholder.com/1920x1080/0000ff/ffffff?text=One2' },
{ id: 8, thumbUrl: 'https://via.placeholder.com/400x300/ffff00/ffffff', url: 'https://via.placeholder.com/1920x1080/ffff00/ffffff?text=One3' },
{ id: 9, thumbUrl: 'https://via.placeholder.com/400x300/ff00ff/ffffff', url: 'https://via.placeholder.com/1920x1080/ff00ff/ffffff?text=One4' },
{ id: 10, thumbUrl: 'https://via.placeholder.com/400x300/00ffff/ffffff', url: 'https://via.placeholder.com/1920x1080/00ffff/ffffff?text=One5' },
{ id: 11, thumbUrl: 'https://via.placeholder.com/400x300/ffffff/000000', url: 'https://via.placeholder.com/1920x1080/ffffff/000000?text=One6' },
{ id: 12, thumbUrl: 'https://via.placeholder.com/400x300/000000/ffffff', url: 'https://via.placeholder.com/1920x1080/000000/ffffff?text=One7' }
]
},
{ title: 'The Longest Title for a Gallery That You Could Ever Imagine (Unless You Have a Really Good Imagination - And Then You Could Probably Think of a Really Big One)',
id: 3,
featuredImage: 'https://marcleopold.isnet.uk/wp-content/uploads/2017/07/music-4-600x400.jpg',
images: [
{ id: 13, thumbUrl: 'https://via.placeholder.com/400x300', url: 'https://via.placeholder.com/1920x1080' },
{ id: 14, thumbUrl: 'https://via.placeholder.com/400x300', url: 'https://via.placeholder.com/1920x1080' },
{ id: 24, thumbUrl: 'https://via.placeholder.com/400x300', url: 'https://via.placeholder.com/1920x1080' },
{ id: 33, thumbUrl: 'https://via.placeholder.com/400x300', url: 'https://via.placeholder.com/1920x1080' }
]
},
{ title: 'Gallery Three',
id: 4,
featuredImage: 'https://via.placeholder.com/600x400',
images: [
{ id: 56, thumbUrl: 'https://via.placeholder.com/400x300', url: 'https://via.placeholder.com/1920x1080' },
{ id: 3456, thumbUrl: 'https://via.placeholder.com/400x300', url: 'https://via.placeholder.com/1920x1080' },
{ id: 947, thumbUrl: 'https://via.placeholder.com/400x300', url: 'https://via.placeholder.com/1920x1080' },
{ id: 837, thumbUrl: 'https://via.placeholder.com/400x300', url: 'https://via.placeholder.com/1920x1080' }
]
},
{ title: 'Gallery Four',
id: 5,
featuredImage: 'https://via.placeholder.com/600x400',
images: [
{ id: 0, thumbUrl: 'https://via.placeholder.com/400x300', url: 'https://via.placeholder.com/1920x1080' },
{ id: 1, thumbUrl: 'https://via.placeholder.com/400x300', url: 'https://via.placeholder.com/1920x1080' },
{ id: 2, thumbUrl: 'https://via.placeholder.com/400x300', url: 'https://via.placeholder.com/1920x1080' },
{ id: 3, thumbUrl: 'https://via.placeholder.com/400x300', url: 'https://via.placeholder.com/1920x1080' }
]
},
{ title: 'Gallery Five',
id: 6,
featuredImage: 'https://via.placeholder.com/600x400',
images: [
{ id: 0, thumbUrl: 'https://via.placeholder.com/400x300', url: 'https://via.placeholder.com/1920x1080' },
{ id: 1, thumbUrl: 'https://via.placeholder.com/400x300', url: 'https://via.placeholder.com/1920x1080' },
{ id: 2, thumbUrl: 'https://via.placeholder.com/400x300', url: 'https://via.placeholder.com/1920x1080' },
{ id: 3, thumbUrl: 'https://via.placeholder.com/400x300', url: 'https://via.placeholder.com/1920x1080' }
]
},
{ title: 'Gallery Six',
id: 7,
featuredImage: 'https://via.placeholder.com/600x400',
images: [
{ id: 0, thumbUrl: 'https://via.placeholder.com/400x300', url: 'https://via.placeholder.com/1920x1080' },
{ id: 1, thumbUrl: 'https://via.placeholder.com/400x300', url: 'https://via.placeholder.com/1920x1080' },
{ id: 2, thumbUrl: 'https://via.placeholder.com/400x300', url: 'https://via.placeholder.com/1920x1080' },
{ id: 3, thumbUrl: 'https://via.placeholder.com/400x300', url: 'https://via.placeholder.com/1920x1080' }
]
},
]
})
})
},
}
</script>

View File

@ -968,7 +968,7 @@
consola "^2.3.0"
node-fetch "^2.3.0"
"@nuxtjs/proxy@^1.3.0":
"@nuxtjs/proxy@^1.3.0", "@nuxtjs/proxy@^1.3.1":
version "1.3.1"
resolved "https://registry.yarnpkg.com/@nuxtjs/proxy/-/proxy-1.3.1.tgz#7d76179aff321491f126d6560434579a4dc7a89a"
integrity sha512-agcTJVRCY0XfZcGV573bdIQLsg9fr5p6zikpxtUzR3xywdUBJ+JMKAiz3ew15bOZGK8lVS8u/PBmZ33iEhr3rg==