From 4b675e33572af55fa98dd082aab1402fdcf2aae4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Thu, 4 May 2017 09:57:10 +0200 Subject: [PATCH] Fix middleware on server-side --- examples/middleware/middleware/visits.js | 3 +- examples/middleware/pages/_slug.vue | 1 + lib/app/client.js | 4 +- lib/app/server.js | 290 ++++++++++------------- lib/app/utils.js | 22 +- 5 files changed, 147 insertions(+), 173 deletions(-) diff --git a/examples/middleware/middleware/visits.js b/examples/middleware/middleware/visits.js index 3ba5ab253f..719079c5bd 100644 --- a/examples/middleware/middleware/visits.js +++ b/examples/middleware/middleware/visits.js @@ -1,3 +1,4 @@ -export default function ({ store, route }) { +export default function ({ store, route, redirect }) { store.commit('ADD_VISIT', route.path) + if (route.fullPath === '/') return redirect('/foo') } diff --git a/examples/middleware/pages/_slug.vue b/examples/middleware/pages/_slug.vue index 4fbd6b57c5..57c3d2a228 100644 --- a/examples/middleware/pages/_slug.vue +++ b/examples/middleware/pages/_slug.vue @@ -12,6 +12,7 @@