Created
October 18, 2017 12:39
-
-
Save JamesTheHacker/6a26366cc5757ee72e2db27a635c99ba to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function fetchedUserFromApi(data) { | |
return { | |
type: FETCHED_USER_FROM_API, | |
data: { | |
isLoading: false, | |
isError: false, | |
...data | |
} | |
} | |
} | |
export const fetchMe = () => dispatch => | |
fetch(`/me`, { method: 'GET' }) | |
.then(res => res.json()) | |
.then(data => dispatch(fetchedUserFromApi(data)) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment