Last active
November 16, 2016 13:32
-
-
Save sAbakumoff/c18859b89e716a0d165609032c858f4b to your computer and use it in GitHub Desktop.
This file contains 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 PUBLICIZE_SHARE = 'PUBLICIZE_SHARE'; | |
const PUBLICIZE_SHARE_SUCCESS = 'PUBLICIZE_SHARE_SUCCESS'; | |
const PUBLICIZE_SHARE_FAILURE = 'PUBLICIZE_SHARE_FAILURE'; | |
const PUBLICIZE_SHARE_DISMISS = 'PUBLICIZE_SHARE_DISMISS'; | |
const sharePostStatus = { | |
[ PUBLICIZE_SHARE ]: ( state, { siteId, postId } ) => | |
( { ...state, [ siteId ]: { ...state[ siteId ], [ postId ]: { | |
requesting: true, | |
} } } ), | |
[ PUBLICIZE_SHARE_SUCCESS ]: ( state, { siteId, postId } ) => | |
( { ...state, [ siteId ]: { ...state[ siteId ], [ postId ]: { | |
requesting: false, | |
success: true, | |
} } } ), | |
[ PUBLICIZE_SHARE_FAILURE ]: ( state, { siteId, postId, error } ) => | |
( { ...state, [ siteId ]: { ...state[ siteId ], [ postId ]: { | |
requesting: false, | |
success: false, | |
error, | |
} } } ), | |
[ PUBLICIZE_SHARE_DISMISS ]: ( state, { siteId, postId } ) => | |
( { ...state, [ siteId ]: { | |
...state[ siteId ], [ postId ]: undefined | |
} } ), | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment