Skip to content

Instantly share code, notes, and snippets.

@mmazzarolo
Last active June 22, 2018 08:23
Show Gist options
  • Save mmazzarolo/b31477508580132d1f35f971c284a0cc to your computer and use it in GitHub Desktop.
Save mmazzarolo/b31477508580132d1f35f971c284a0cc to your computer and use it in GitHub Desktop.
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 })
}
}
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()
}
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