Skip to content

Commit 45f8bd5

Browse files
committed
auth reducer return value
1 parent 2d2c4df commit 45f8bd5

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

server/client/src/actions/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ import { FETCH_USER } from './types';
44
export const fetchUser = () => async dispatch => {
55
const res = await axios.get('/api/current_user');
66

7-
dispatch({ type: FETCH_USER, payload: res });
7+
dispatch({ type: FETCH_USER, payload: res.data });
88
};

server/client/src/reducers/authReducer.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
export default function(state = {}, action) {
2-
console.log(action);
1+
import { FETCH_USER } from '../actions/types';
2+
3+
export default function(state = null, action) {
34
switch (action.type) {
5+
case FETCH_USER:
6+
return action.payload || false;
47
default:
58
return state;
69
}

0 commit comments

Comments
 (0)