Created
June 4, 2016 04:46
-
-
Save douglascorrea/fe5008490da734efd5cca771ab400740 to your computer and use it in GitHub Desktop.
firebase-error-solved.js6
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
import * as types from './actionTypes'; | |
import {beginAjaxCall, ajaxCallError} from './ajaxStatusActions'; | |
import FirebaseApi from '../api/mockFirebaseApi'; | |
import * as firebase from 'firebase'; | |
/// THIS WORKS | |
export function userCreatedSuccess(user) { | |
return {type: types.USER_CREATED_SUCCESS, user: { | |
email: user.email | |
}}; | |
} | |
/// THIS MAKES | |
export function userCreatedSuccess(user) { | |
return {type: types.USER_CREATED_SUCCESS, user}; //// <<< ES6 Shorthand property names makes my code fails with Uncaught SecurityError: Blocked a frame with origin | |
} | |
export function initializeFirebase() { | |
return dispatch => { | |
// Initialize Firebase | |
const config = { | |
apiKey: "AIzaSyAknA11GkEAxay7fzXgmcE-DteOePeNxn4", | |
authDomain: "react-redux-pluralsight-fb.firebaseapp.com", | |
databaseURL: "https://react-redux-pluralsight-fb.firebaseio.com", | |
storageBucket: "react-redux-pluralsight-fb.appspot.com" | |
}; | |
firebase.initializeApp(config); | |
}; | |
} | |
export function createUserWithEmailAndPassword(user) { | |
return function(dispatch) { | |
dispatch(beginAjaxCall()); | |
return firebase.auth().createUserWithEmailAndPassword(user.email, user.password).then(user => { | |
console.log('user'); | |
console.log(user); | |
dispatch(userCreatedSuccess(user)); | |
}).catch(error => { | |
console.log('error'); | |
console.log(error); | |
throw(error); | |
}); | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment