Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const publishSuccess = successResponse => {
const state = getState();
const myClaims = selectMyClaims(state);
const pendingClaim = successResponse.outputs[0];
analytics.apiLogPublish(pendingClaim);
const { permanent_url: url } = pendingClaim;
const actions = [];
// @if TARGET='app'
actions.push(push(`/$/${PAGES.PUBLISHED}`));
// @endif
actions.push({
type: ACTIONS.PUBLISH_SUCCESS,
});
// We have to fake a temp claim until the new pending one is returned by claim_list_mine
// We can't rely on claim_list_mine because there might be some delay before the new claims are returned
// Doing this allows us to show the pending claim immediately, it will get overwritten by the real one
const isMatch = claim => claim.claim_id === pendingClaim.claim_id;
const isEdit = myClaims.some(isMatch);
const publishSuccess = successResponse => {
const state = getState();
analytics.apiLogPublish();
const myClaims = selectMyClaims(state);
const pendingClaim = successResponse.outputs[0];
const uri = pendingClaim.permanent_url;
const actions = [];
actions.push({
type: ACTIONS.PUBLISH_SUCCESS,
});
// We have to fake a temp claim until the new pending one is returned by claim_list_mine
// We can't rely on claim_list_mine because there might be some delay before the new claims are returned
// Doing this allows us to show the pending claim immediately, it will get overwritten by the real one
const isMatch = claim => claim.claim_id === pendingClaim.claim_id;
const isEdit = myClaims.some(isMatch);
const myNewClaims = isEdit
? myClaims.map(claim => (isMatch(claim) ? pendingClaim : claim))
const publishSuccess = successResponse => {
const state = getState();
const myClaims = selectMyClaims(state);
const pendingClaim = successResponse.outputs[0];
analytics.apiLogPublish(pendingClaim);
const { permanent_url: url } = pendingClaim;
const actions = [];
actions.push({
type: ACTIONS.PUBLISH_SUCCESS,
});
// We have to fake a temp claim until the new pending one is returned by claim_list_mine
// We can't rely on claim_list_mine because there might be some delay before the new claims are returned
// Doing this allows us to show the pending claim immediately, it will get overwritten by the real one
const isMatch = claim => claim.claim_id === pendingClaim.claim_id;
const isEdit = myClaims.some(isMatch);
const myNewClaims = isEdit
? myClaims.map(claim => (isMatch(claim) ? pendingClaim : claim))
: myClaims.concat(pendingClaim);
actions.push(doOpenModal(MODALS.PUBLISH, { uri: url, isEdit, filePath }));
const success = channelClaim => {
this.setState({
creatingChannel: false,
});
analytics.apiLogPublish(channelClaim);
if (onSuccess !== undefined) {
onSuccess({ ...this.props, ...this.state });
}
};