Last active
May 31, 2018 21:18
-
-
Save Jahans3/316bc6a6c40ab0a6a5cf9267adafa90b 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
const TwitterUser = Interface('TwitterUser')({ | |
twitterId: type('string'), | |
twitterUsername: type('string') | |
},{ | |
trim: true, | |
extends: User, | |
rename: { twitter_id: 'twitterId', twitter_username: 'twitterUsername' } | |
}) | |
const getUser = () => async dispatch => { | |
dispatch(fetchUsersBegin()) | |
try { | |
const response = await twitterService.getUser() | |
const ValidTwitterUser = implement(TwitterUser)(response) | |
dispatch(fetchUserSuccess(ValidTwitterUser)) | |
} catch (err) { | |
dispatch(fetchUserError(err)) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment