doPublish: Add optional parameter for "preview-only" request.
This commit is contained in:
parent
903d425188
commit
12ba291c3b
2 changed files with 30 additions and 5 deletions
16
dist/bundle.es.js
vendored
16
dist/bundle.es.js
vendored
|
@ -4370,8 +4370,10 @@ const doPrepareEdit = (claim, uri, fileInfo, fs) => dispatch => {
|
|||
dispatch({ type: DO_PREPARE_EDIT, data: publishData });
|
||||
};
|
||||
|
||||
const doPublish = (success, fail) => (dispatch, getState) => {
|
||||
const doPublish = (success, fail, preview) => (dispatch, getState) => {
|
||||
if (!preview) {
|
||||
dispatch({ type: PUBLISH_START });
|
||||
}
|
||||
|
||||
const state = getState();
|
||||
const myClaimForUri = selectMyClaimForUri(state);
|
||||
|
@ -4428,7 +4430,8 @@ const doPublish = (success, fail) => (dispatch, getState) => {
|
|||
languages: [language],
|
||||
tags: tags && tags.map(tag => tag.name),
|
||||
thumbnail_url: thumbnail,
|
||||
blocking: true
|
||||
blocking: true,
|
||||
preview: false
|
||||
};
|
||||
// Temporary solution to keep the same publish flow with the new tags api
|
||||
// Eventually we will allow users to enter their own tags on publish
|
||||
|
@ -4480,6 +4483,15 @@ const doPublish = (success, fail) => (dispatch, getState) => {
|
|||
// The sdk will figure it out
|
||||
if (filePath) publishPayload.file_path = filePath;
|
||||
|
||||
if (preview) {
|
||||
publishPayload.preview = true;
|
||||
publishPayload.optimize_file = false;
|
||||
|
||||
return lbryProxy.publish(publishPayload).then(previewResponse => {
|
||||
return preview(previewResponse);
|
||||
}, fail);
|
||||
}
|
||||
|
||||
return lbryProxy.publish(publishPayload).then(response => {
|
||||
if (!useLBRYUploader) {
|
||||
return success(response);
|
||||
|
|
|
@ -230,11 +230,13 @@ export const doPrepareEdit = (claim: StreamClaim, uri: string, fileInfo: FileLis
|
|||
dispatch({ type: ACTIONS.DO_PREPARE_EDIT, data: publishData });
|
||||
};
|
||||
|
||||
export const doPublish = (success: Function, fail: Function) => (
|
||||
export const doPublish = (success: Function, fail: Function, preview: Function) => (
|
||||
dispatch: Dispatch,
|
||||
getState: () => {}
|
||||
) => {
|
||||
if (!preview) {
|
||||
dispatch({ type: ACTIONS.PUBLISH_START });
|
||||
}
|
||||
|
||||
const state = getState();
|
||||
const myClaimForUri = selectMyClaimForUri(state);
|
||||
|
@ -302,6 +304,7 @@ export const doPublish = (success: Function, fail: Function) => (
|
|||
locations?: Array<any>,
|
||||
blocking: boolean,
|
||||
optimize_file?: boolean,
|
||||
preview?: boolean,
|
||||
} = {
|
||||
name,
|
||||
title,
|
||||
|
@ -312,6 +315,7 @@ export const doPublish = (success: Function, fail: Function) => (
|
|||
tags: tags && tags.map(tag => tag.name),
|
||||
thumbnail_url: thumbnail,
|
||||
blocking: true,
|
||||
preview: false,
|
||||
};
|
||||
// Temporary solution to keep the same publish flow with the new tags api
|
||||
// Eventually we will allow users to enter their own tags on publish
|
||||
|
@ -363,6 +367,15 @@ export const doPublish = (success: Function, fail: Function) => (
|
|||
// The sdk will figure it out
|
||||
if (filePath) publishPayload.file_path = filePath;
|
||||
|
||||
if (preview) {
|
||||
publishPayload.preview = true;
|
||||
publishPayload.optimize_file = false;
|
||||
|
||||
return Lbry.publish(publishPayload).then((previewResponse: PublishResponse) => {
|
||||
return preview(previewResponse);
|
||||
}, fail);
|
||||
}
|
||||
|
||||
return Lbry.publish(publishPayload).then((response: PublishResponse) => {
|
||||
if (!useLBRYUploader) {
|
||||
return success(response);
|
||||
|
|
Loading…
Reference in a new issue