const router = new Router({ | |
routes: [ | |
{ | |
path: '/', | |
name: 'Home', | |
component: Home, | |
meta: { requiresAuth: true} | |
}, | |
{ | |
path: '/notes', | |
name: 'Notes', | |
component: Notes, | |
params: { | |
'foo': 'bar' | |
}, | |
meta: { requiresAuth: true} | |
}, | |
{ | |
path: '/menu', | |
name: 'Menu', | |
component: Menu, | |
meta: { requiresAuth: true} | |
}, | |
{ | |
path: '/profile', | |
name: 'Profile', | |
component: Profile, | |
meta: { requiresAuth: true} | |
}, | |
{ | |
path: '/auth', | |
name: 'Authenticator', | |
component: components.Authenticator | |
} | |
] | |
}); | |
router.beforeResolve((to, from, next) => { | |
if (to.matched.some(record => record.meta.requiresAuth)) { | |
let user; | |
Vue.prototype.$Amplify.Auth.currentAuthenticatedUser().then(data => { | |
if (data && data.signInUserSession) { | |
user = data; | |
} | |
next() | |
}).catch((e) => { | |
next({ | |
path: '/auth', | |
query: { | |
redirect: to.fullPath, | |
} | |
}); | |
}); | |
} | |
next() | |
}) |
This comment has been minimized.
This comment has been minimized.
Hey @aossey, I've just updated the post to use the most current versions of all of our libraries, everything should be working now. |
This comment has been minimized.
This comment has been minimized.
Awesome! Thanks for taking time to do that, really appreciate it. |
This comment has been minimized.
This comment has been minimized.
Hi Nader(@dabit3), you mentioned that you updated your post to use the most current versions of all the libraries which is great but going to the AWS Docs, the Vue Framework guides are still utilizing aws-amplify-vue. Can these also be updated? And until then, can you explain a bit how to use the new libraries as a plugin in Vue and if we should still be using the AmplifyEventBus or you recommend using the Hub? Thank you very much! |
This comment has been minimized.
This comment has been minimized.
Hey @cnegrisanu, can you you point me to the docs still using the old Vue libraries? I know we've updated most of our documentation here to use the new ones: https://docs.amplify.aws/ |
This comment has been minimized.
This comment has been minimized.
Damn, don't I feel stupid now?.. Here's the link that I was looking at. I guess it's a full copy of the previous Docs version and it looked so real that I didn't even check the url...
|
This comment has been minimized.
I'm trying to follow your tutorial here and adapt it to my paths, but code in line 41 of this gist causes the following error when you build and run the solution.
Any idea what I may be doing wrong in my code here:
Thank you for the tutorial and in advance for the answer.