Last active
June 22, 2018 08:23
-
-
Save mmazzarolo/b31477508580132d1f35f971c284a0cc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function* signup (action) { | |
const { email, password } = action | |
try { | |
const user = yield call(parseService.signup, email, password) | |
yield put({ type: authActionTypes.SIGNUP_SUCCESS, user }) | |
yield call(loginSuccess, user) | |
} catch (err) { | |
const error = err.message || err | |
yield put({ type: authActionTypes.SIGNUP_FAILURE, error }) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const signup = async (email, password) => { | |
const user = new Parse.User() | |
user.set('username', email) | |
user.set('email', email) | |
user.set('password', password) | |
const loggedUser = await user.signUp() | |
return loggedUser.toJSON() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function* showErrorAlert (action) { | |
const { error } = action | |
yield call(Alert.alert, i18n.t('ERROR_TITLE'), error) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment