We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2d2c4df commit 45f8bd5Copy full SHA for 45f8bd5
server/client/src/actions/index.js
@@ -4,5 +4,5 @@ import { FETCH_USER } from './types';
4
export const fetchUser = () => async dispatch => {
5
const res = await axios.get('/api/current_user');
6
7
- dispatch({ type: FETCH_USER, payload: res });
+ dispatch({ type: FETCH_USER, payload: res.data });
8
};
server/client/src/reducers/authReducer.js
@@ -1,6 +1,9 @@
1
-export default function(state = {}, action) {
2
- console.log(action);
+import { FETCH_USER } from '../actions/types';
+
3
+export default function(state = null, action) {
switch (action.type) {
+ case FETCH_USER:
+ return action.payload || false;
default:
return state;
9
}
0 commit comments