blob: e13ab10dfe9d281427d9c7a3084f7c84dd8a6eaa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
import { firebase } from '../firebase.js';
export const AUTH_FAIL = 'AUTH_FAIL';
export const AUTH_SUCCESS = 'AUTH_SUCCESS';
const auth = firebase.auth();
export const signIn = (_email, _password) => (dispatch) => {
auth.signInWithEmailAndPassword(_email, _password).then((user) => {
dispatch(authSuccess(user.email));
})
.catch((error) => {
dispatch(authFail(error.code));
});
}
export const authFail = (errorCode) => {
return {
type: AUTH_FAIL,
payload: false
}
}
export const authSuccess = (email) => {
return {
type: AUTH_SUCCESS,
payload: true
}
}
|