I am trying to create a new user using firebase auth. I am using redux-saga to make the above call.
Below is my saga.js:
import { takeLatest, put } from 'redux-saga/effects';
import { SIGN_UP, AUTHENTICATION_FAILED, SIGN_UP_SUCCESS} from '../actions/index';
import firebase from 'firebase';
function* signUp(action){
console.log("about to call authentication"); // This being printed
firebase.auth().createUserWithEmailAndPassword(action.user.email, action.user.password)
.then(function*(result){
console.log("success"); // Not being loged
yield put({SIGN_UP_SUCCESS, user: action.user});
}).catch(function*(error){
console.log("failed"); //Not being loged
let error_message = { code: error.code, message: error.message};
yield put({AUTHENTICATION_FAILED, error: error_message});
});
}
function* rootSaga(){
yield takeLatest(SIGN_UP, signUp);
}
export default rootSaga;
The code inside then
and catch
is not being executed, Sign Up generator function is being called. Can anyone please tell me what I am doing wrong?