Skip to content

Commit

Permalink
binxhealth#9 - Added route to deal with non-matching path and a new c…
Browse files Browse the repository at this point in the history
…omponent for page not found.
  • Loading branch information
sfrankian committed May 27, 2018
1 parent 3a3adb3 commit 21856d0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
14 changes: 14 additions & 0 deletions src/components/PageNotFound.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<template>
<div class="container-fluid">
<h2>Uh oh, the force was not with {{ $route.path }}.</h2>
<img
:src="'https://upload.wikimedia.org/wikipedia/commons/thumb/1/1e/YODA_%283343464749%29.jpg/640px-YODA_%283343464749%29.jpg'"
alt="Yoda image">
<div class="row pt-3 pl-3">
<router-link
:to="`/`">
<button>Return home</button>
</router-link>
</div>
</div>
</template>
6 changes: 5 additions & 1 deletion src/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Vue.use(VueRouter)

const Home = () => import('@/components/Home')
const Person = () => import('@/components/Person')

const PageNotFound = () => import('@/components/PageNotFound')
// Export a new Vue Router instance to be used in the application.
export default new VueRouter({
routes: [
Expand All @@ -17,6 +17,10 @@ export default new VueRouter({
{
path: '/people/:id',
component: Vue.component('Person', Person)
},
{
path: '*',
component: Vue.component('PageNotFound', PageNotFound)
}
]
})

0 comments on commit 21856d0

Please sign in to comment.