diff --git a/dist/bundle.es.js b/dist/bundle.es.js index 341f87a..8a8a9d0 100644 --- a/dist/bundle.es.js +++ b/dist/bundle.es.js @@ -4520,8 +4520,7 @@ function doCollectionPublishUpdate(options, isBackgroundUpdate) { locations: [], blocking: true, claim_id: options.claim_id, - clear_claims: true, - replace: true + clear_claims: true }; if (isBackgroundUpdate && updateParams.claim_id) { @@ -5629,7 +5628,7 @@ const doUpdatePublishForm = publishFormValue => dispatch => dispatch({ data: _extends$7({}, publishFormValue) }); -const doUploadThumbnail = (filePath, thumbnailBlob, fsAdapter, fs, path) => dispatch => { +const doUploadThumbnail = (filePath, thumbnailBlob, fsAdapter, fs, path, cb) => dispatch => { const downMessage = __('Thumbnail upload service may be down, try again later.'); let thumbnail, fileExt, fileName, fileType; @@ -5663,13 +5662,17 @@ const doUploadThumbnail = (filePath, thumbnailBlob, fsAdapter, fs, path) => disp method: 'POST', body: data }).then(res => res.text()).then(text => text.length ? JSON.parse(text) : {}).then(json => { - return json.success ? dispatch({ + if (!json.success) return uploadError(json.message || downMessage); + if (cb) { + cb(json.data.serveUrl); + } + return dispatch({ type: UPDATE_PUBLISH_FORM, data: { uploadThumbnailStatus: COMPLETE, thumbnail: json.data.serveUrl } - }) : uploadError(json.message || downMessage); + }); }).catch(err => { let message = err.message; diff --git a/src/redux/actions/claims.js b/src/redux/actions/claims.js index a287087..f5bf190 100644 --- a/src/redux/actions/claims.js +++ b/src/redux/actions/claims.js @@ -859,7 +859,6 @@ export function doCollectionPublishUpdate( languages?: Array, claims?: Array, clear_claims: boolean, - replace: boolean, } = isBackgroundUpdate ? { blocking: true, @@ -877,7 +876,6 @@ export function doCollectionPublishUpdate( blocking: true, claim_id: options.claim_id, clear_claims: true, - replace: true, }; if (isBackgroundUpdate && updateParams.claim_id) { diff --git a/src/redux/actions/publish.js b/src/redux/actions/publish.js index 36222c0..239a9bd 100644 --- a/src/redux/actions/publish.js +++ b/src/redux/actions/publish.js @@ -69,7 +69,8 @@ export const doUploadThumbnail = ( thumbnailBlob?: File, fsAdapter?: any, fs?: any, - path?: any + path?: any, + cb?: (string) => void ) => (dispatch: Dispatch) => { const downMessage = __('Thumbnail upload service may be down, try again later.'); let thumbnail, fileExt, fileName, fileType; @@ -112,15 +113,17 @@ export const doUploadThumbnail = ( .then(res => res.text()) .then(text => (text.length ? JSON.parse(text) : {})) .then(json => { - return json.success - ? dispatch({ - type: ACTIONS.UPDATE_PUBLISH_FORM, - data: { - uploadThumbnailStatus: THUMBNAIL_STATUSES.COMPLETE, - thumbnail: json.data.serveUrl, - }, - }) - : uploadError(json.message || downMessage); + if (!json.success) return uploadError(json.message || downMessage); + if (cb) { + cb(json.data.serveUrl); + } + return dispatch({ + type: ACTIONS.UPDATE_PUBLISH_FORM, + data: { + uploadThumbnailStatus: THUMBNAIL_STATUSES.COMPLETE, + thumbnail: json.data.serveUrl, + }, + }); }) .catch(err => { let message = err.message;