From 463a8f6c818a512018a0b6e1edd517084dafd616 Mon Sep 17 00:00:00 2001 From: ManjaroOne666 Date: Fri, 15 Feb 2019 11:05:14 +0000 Subject: [PATCH] default imageUrl --- pages/contact.vue | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/pages/contact.vue b/pages/contact.vue index bb10871..8698985 100644 --- a/pages/contact.vue +++ b/pages/contact.vue @@ -162,8 +162,17 @@ export default { }, async asyncData ({ $axios }) { - const { imageUrl } = await $axios.$get('/api/v1/page/about') - return { imageUrl } + try { + const { imageUrl } = await $axios.$get('/api/v1/page/about') + if (!imageUrl) { + throw new Error('empty imageUrl') + } + return { imageUrl } + } catch { + return { + imageUrl: '/img/default-contact.jpg' + } + } }, }