router, auth, edit, first autocomplete, bascis structure, no design

This commit is contained in:
scammo
2021-06-25 19:28:41 +02:00
parent 356aa738fb
commit 16b03bb5f2
9 changed files with 314 additions and 92 deletions

View File

@ -9,7 +9,17 @@ const routes = [
path: '/s',
name: 's',
component: {
template: "<router-view/>"
template: "<router-view/>",
},
beforeEnter: (to, from, next) => {
console.log('test')
console.log('token', localStorage.getItem('token'))
if(localStorage.getItem('token') !== null){
console.log('next')
next()
}else{
next({path: '/', query: {url: to.fullPath, access: false}})
}
},
children: [
{
@ -18,12 +28,12 @@ const routes = [
component: Search
},
{
path: '/profile/:member',
path: 'profile/:member',
name: 'ProfileMember',
component: View
},
{
path: '/profile-edit',
path: 'profile-edit',
name: 'ProfileEdit',
component: Edit
},