Guest User

Untitled

a guest
Nov 16th, 2018
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. signIn: function () {
  2. let ctx = this;
  3.  
  4. // backend-auth: use this code if you'd wanna handle the goole auth on your backend
  5. //Vue.googleAuth().signIn(this.onSignInSuccess, this.onSignInError)
  6.  
  7. // frontend-auth: we use this in the example to retrieve the full level of user auth on the frontend
  8. Vue.googleAuth().directAccess()
  9. Vue.googleAuth().signIn(function (googleUser) {
  10. let user = JSON.parse(JSON.stringify(googleUser));
  11. localStorage.currentUser = JSON.stringify(user.w3);
  12.  
  13. ctx.$store.dispatch('login')
  14. // console.log('redirect to ', ctx.$route.query.redirect)
  15. ctx.$router.replace(ctx.$route.query.redirect || '/authors')
  16. }, function (error) {
  17. console.log(error)
  18. })
  19. }
Add Comment
Please, Sign In to add comment