Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let handleUserLoginCallbacks = (data, success, error) => {
- let { username, password } = data
- server.login(username, password, (userdata) => {
- success(userdata)
- }, (err) => {
- if (err.needsAuth) {
- let requestAuth = (authType) => {
- app.requestUserAuth(authType, (authData) => {
- authResponse(authData)
- }, (requestAuthError) => {
- error(requestAuthError)
- })
- }
- let authResponse = (authData) => {
- server.authenticate(authData, (userdata) => {
- success(userdata)
- }, (authError) => {
- if (authError.needsAuth) {
- requestAuth(authError.authType)
- } else {
- error(err)
- }
- })
- }
- requestAuth(err.authType)
- } else {
- error(err)
- }
- })
- }
Add Comment
Please, Sign In to add comment