Stop using logout
when no locally stored user was found.
This was causing users to not be able to sign up with Netlify Identity.
This commit is contained in:
parent
0f8a74be13
commit
d378488e0f
@ -6,6 +6,7 @@ const { notifSend } = notifActions;
|
||||
export const AUTH_REQUEST = 'AUTH_REQUEST';
|
||||
export const AUTH_SUCCESS = 'AUTH_SUCCESS';
|
||||
export const AUTH_FAILURE = 'AUTH_FAILURE';
|
||||
export const AUTH_REQUEST_DONE = 'AUTH_REQUEST_DONE';
|
||||
export const LOGOUT = 'LOGOUT';
|
||||
|
||||
export function authenticating() {
|
||||
@ -29,6 +30,12 @@ export function authError(error) {
|
||||
};
|
||||
}
|
||||
|
||||
export function doneAuthenticating() {
|
||||
return {
|
||||
type: AUTH_REQUEST_DONE,
|
||||
};
|
||||
}
|
||||
|
||||
export function logout() {
|
||||
return {
|
||||
type: LOGOUT,
|
||||
@ -46,7 +53,7 @@ export function authenticateUser() {
|
||||
if (user) {
|
||||
dispatch(authenticate(user));
|
||||
} else {
|
||||
dispatch(logoutUser());
|
||||
dispatch(doneAuthenticating());
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import Immutable from 'immutable';
|
||||
import { AUTH_REQUEST, AUTH_SUCCESS, AUTH_FAILURE, LOGOUT } from '../actions/auth';
|
||||
import { AUTH_REQUEST, AUTH_SUCCESS, AUTH_FAILURE, AUTH_REQUEST_DONE, LOGOUT } from '../actions/auth';
|
||||
|
||||
const auth = (state = null, action) => {
|
||||
switch (action.type) {
|
||||
@ -9,6 +9,8 @@ const auth = (state = null, action) => {
|
||||
return Immutable.fromJS({ user: action.payload });
|
||||
case AUTH_FAILURE:
|
||||
return Immutable.Map({ error: action.payload.toString() });
|
||||
case AUTH_REQUEST_DONE:
|
||||
return state.remove('isFetching');
|
||||
case LOGOUT:
|
||||
return state.remove('user').remove('isFetching');
|
||||
default:
|
||||
|
Loading…
x
Reference in New Issue
Block a user