Skip to content

Commit c9ba220

Browse files
committed
basics of redux thunk
1 parent 90a4fbf commit c9ba220

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

server/client/src/actions/index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,9 @@ import axios from 'axios';
22
import { FETCH_USER } from './types';
33

44
const fetchUser = () => {
5-
axios.get('/api/current_user');
5+
return function(dispatch) {
6+
axios
7+
.get('/api/current_user')
8+
.then(res => dispatch({ type: FETCH_USER, payload: res }));
9+
};
610
};

0 commit comments

Comments
 (0)