From 2677afb46fc4a950d62f32e6172aeaa2fdcc5a8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Thu, 17 Nov 2016 11:57:02 +0100 Subject: [PATCH] Fix due 2.0.6~7 and add error() in context --- examples/custom-routes/pages/_user.vue | 5 ++- examples/hello-world/pages/about.vue | 11 ++++++ examples/with-ava/test/index.test.js | 2 + lib/app/client.js | 52 ++++++++++++++++---------- lib/app/server.js | 6 +++ lib/app/utils.js | 3 +- package.json | 12 +++--- 7 files changed, 63 insertions(+), 28 deletions(-) diff --git a/examples/custom-routes/pages/_user.vue b/examples/custom-routes/pages/_user.vue index 4375b79bb9..4e6985d537 100644 --- a/examples/custom-routes/pages/_user.vue +++ b/examples/custom-routes/pages/_user.vue @@ -11,9 +11,12 @@ import axios from 'axios' export default { - data ({ params }) { + data ({ params, error }) { return axios.get(`http://jsonplaceholder.typicode.com/users/${params.id}`) .then((res) => res.data) + .catch(() => { + error({ message: 'User not found', statusCode: 404 }) + }) } } diff --git a/examples/hello-world/pages/about.vue b/examples/hello-world/pages/about.vue index 5fa5f7abbc..4d605252c4 100755 --- a/examples/hello-world/pages/about.vue +++ b/examples/hello-world/pages/about.vue @@ -2,10 +2,21 @@

Thank you for testing nuxt.js

+

Loaded from the {{ name }}

Back home

+ +