initial commit

This commit is contained in:
JJ Kasper
2018-05-17 14:31:05 -05:00
commit 2c90d2e7dd
79 changed files with 10684 additions and 0 deletions

45
redux/reducers/userRed.js Normal file
View File

@@ -0,0 +1,45 @@
import {
SET_USER,
LOGIN_PENDING,
LOGIN_FAILED,
LOGOUT
} from '../actions/userAct';
const initState = {
setup: false,
_id: null,
email: null,
admin: null,
pending: false,
error: null
};
function user(state=initState, action) {
switch(action.type) {
case SET_USER: {
return {
...initState,
...action.data
};
}
case LOGIN_PENDING: {
return {
...initState,
pending: true
};
}
case LOGIN_FAILED: {
return {
...state,
pending: false,
error: action.data
};
}
case LOGOUT: {
return initState;
}
default: return state;
}
}
export default user;