From 3d1b4f0ee261a83f912a028e6820e63c90d89d48 Mon Sep 17 00:00:00 2001 From: Nilesh P Date: Fri, 30 Aug 2019 22:01:47 -0400 Subject: [PATCH] update for issue/bug #100 --- README.md | 1 + middleware/README.md | 9 ++++----- middleware/parsedefaulturl.js | 5 +++++ pages/index.vue | 3 ++- 4 files changed, 12 insertions(+), 6 deletions(-) create mode 100644 middleware/parsedefaulturl.js diff --git a/README.md b/README.md index 3c14dbeea..22f34e81b 100644 --- a/README.md +++ b/README.md @@ -184,6 +184,7 @@ See the [CHANGELOG](CHANGELOG.md) file for details. * [Nicholas La Roux](https://github.com/larouxn) * [RifqiAlAbqary](https://github.com/reefqi037) * [izerozlu](https://github.com/izerozlu) +* [Nilesh Patel](https://github.com/NileshSP) ### Thanks * [Dribbble](https://dribbble.com) diff --git a/middleware/README.md b/middleware/README.md index 01595ded7..bf0efbb23 100644 --- a/middleware/README.md +++ b/middleware/README.md @@ -1,8 +1,7 @@ # MIDDLEWARE - -**This directory is not required, you can delete it if you don't want to use it.** - -This directory contains your application middleware. -Middleware let you define custom functions that can be run before rendering either a page or a group of pages. +
+parsedefaulturl.js - parse default url for appropriate path +
+
More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/routing#middleware). diff --git a/middleware/parsedefaulturl.js b/middleware/parsedefaulturl.js new file mode 100644 index 000000000..90fb6cf92 --- /dev/null +++ b/middleware/parsedefaulturl.js @@ -0,0 +1,5 @@ +export default function({ route, redirect }) { + if(route.fullPath !== '/') { + return redirect('/'); + } +} \ No newline at end of file diff --git a/pages/index.vue b/pages/index.vue index d782a9b0b..518200a47 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -243,7 +243,8 @@ export const findStatusGroup = responseStatus => statusCategories.find(status => status.statusCodeRegex.test(responseStatus)); export default { - directives: { + middleware: 'parsedefaulturl', // calls middleware before loading the page + directives: { textareaAutoHeight }, components: {