Created
November 16, 2016 15:08
-
-
Save sAbakumoff/14118c1fe71d2810c8615ac01d12a8d3 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
'use strict'; | |
var _sharePostStatus; | |
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | |
var PUBLICIZE_SHARE = 'PUBLICIZE_SHARE'; | |
var PUBLICIZE_SHARE_SUCCESS = 'PUBLICIZE_SHARE_SUCCESS'; | |
var PUBLICIZE_SHARE_FAILURE = 'PUBLICIZE_SHARE_FAILURE'; | |
var PUBLICIZE_SHARE_DISMISS = 'PUBLICIZE_SHARE_DISMISS'; | |
function update(state, action, post_status) { | |
var next_state = Object.assign({}, state); | |
var post = {}; | |
post[action.postId] = post_status; | |
next_state[action.siteId] = Object.assign({}, next_state[action.siteId], post); | |
return next_state; | |
}; | |
var sharePostStatus = (_sharePostStatus = {}, _defineProperty(_sharePostStatus, PUBLICIZE_SHARE, function (state, action) { | |
return update(state, action, { requesting: true }); | |
}), _defineProperty(_sharePostStatus, PUBLICIZE_SHARE_SUCCESS, function (state, action) { | |
return update(state, action, { requesting: false, success: true }); | |
}), _defineProperty(_sharePostStatus, PUBLICIZE_SHARE_FAILURE, function (state, action) { | |
return update(state, action, { requesting: false, success: false, error: action.error }); | |
}), _defineProperty(_sharePostStatus, PUBLICIZE_SHARE_DISMISS, function (state, action) { | |
return update(state, action, undefined); | |
}), _sharePostStatus); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment