Guest User

Untitled

a guest
Oct 17th, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. let handleUserLoginCallbacks = (data, success, error) => {
  2. let { username, password } = data
  3. server.login(username, password, (userdata) => {
  4. success(userdata)
  5. }, (err) => {
  6. if (err.needsAuth) {
  7. let requestAuth = (authType) => {
  8. app.requestUserAuth(authType, (authData) => {
  9. authResponse(authData)
  10. }, (requestAuthError) => {
  11. error(requestAuthError)
  12. })
  13. }
  14. let authResponse = (authData) => {
  15. server.authenticate(authData, (userdata) => {
  16. success(userdata)
  17. }, (authError) => {
  18. if (authError.needsAuth) {
  19. requestAuth(authError.authType)
  20. } else {
  21. error(err)
  22. }
  23. })
  24. }
  25. requestAuth(err.authType)
  26. } else {
  27. error(err)
  28. }
  29. })
  30. }
Add Comment
Please, Sign In to add comment