update: fallback if no/emptyapi response
This commit is contained in:
parent
28a561dac0
commit
3c8fb01df9
1
TODO.md
1
TODO.md
|
@ -1,4 +1,5 @@
|
|||
## TODO
|
||||
* General - fallbacks in case no api response
|
||||
* General - sort things by sort_order
|
||||
* General - page headings etc - use api
|
||||
* mailer
|
||||
|
|
|
@ -68,15 +68,25 @@ export default {
|
|||
},
|
||||
|
||||
mounted () {
|
||||
if (this.bgImages.length > 1) {
|
||||
if (this.bgImages.length > 0) {
|
||||
this.setNextIndex()
|
||||
this.showHeading = true
|
||||
}
|
||||
},
|
||||
|
||||
async asyncData({ $axios }) {
|
||||
try {
|
||||
const { bgImages, taglines } = await $axios.$get('/api/v1/home')
|
||||
if (bgImages.length < 1) {
|
||||
throw new Error('bgImages empty')
|
||||
}
|
||||
return { bgImages, taglines }
|
||||
} catch {
|
||||
return {
|
||||
bgImages: ['/img/default-home.jpg'],
|
||||
taglines: [''],
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 194 KiB |
Loading…
Reference in New Issue