Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- signIn: function () {
- let ctx = this;
- // backend-auth: use this code if you'd wanna handle the goole auth on your backend
- //Vue.googleAuth().signIn(this.onSignInSuccess, this.onSignInError)
- // frontend-auth: we use this in the example to retrieve the full level of user auth on the frontend
- Vue.googleAuth().directAccess()
- Vue.googleAuth().signIn(function (googleUser) {
- let user = JSON.parse(JSON.stringify(googleUser));
- localStorage.currentUser = JSON.stringify(user.w3);
- ctx.$store.dispatch('login')
- // console.log('redirect to ', ctx.$route.query.redirect)
- ctx.$router.replace(ctx.$route.query.redirect || '/authors')
- }, function (error) {
- console.log(error)
- })
- }
Add Comment
Please, Sign In to add comment