diff --git a/src/renderer/redux/actions/publish.js b/src/renderer/redux/actions/publish.js index ba93acb2b..ba0da04b8 100644 --- a/src/renderer/redux/actions/publish.js +++ b/src/renderer/redux/actions/publish.js @@ -34,7 +34,12 @@ export const doPrepareEdit = (claim: any) => (dispatch: Dispatch) => { const { author, description, - fee, + // use same values as default state + // fee will be undefined for free content + fee = { + amount: 0, + currency: 'LBC', + }, language, license, licenseUrl, @@ -67,7 +72,7 @@ export const doPublish = (params: PublishParams): ThunkAction => { const { name, bid, - filePath: file_path, + filePath, description, language, license, @@ -102,7 +107,7 @@ export const doPublish = (params: PublishParams): ThunkAction => { } const publishPayload = { - file_path, + file_path: filePath, name, channel_name: channelName, bid, @@ -130,52 +135,50 @@ export const doPublish = (params: PublishParams): ThunkAction => { }; // Calls claim_list_mine until any pending publishes are confirmed -export const doCheckPendingPublishes = () => { - return (dispatch: Dispatch, getState: GetState) => { - const state = getState(); - const pendingPublishes = selectPendingPublishes(state); - const myClaims = selectMyClaimsWithoutChannels(state); +export const doCheckPendingPublishes = () => (dispatch: Dispatch, getState: GetState) => { + const state = getState(); + const pendingPublishes = selectPendingPublishes(state); + const myClaims = selectMyClaimsWithoutChannels(state); - let publishCheckInterval; + let publishCheckInterval; - const checkFileList = () => { - Lbry.claim_list_mine().then(claims => { - const claimsWithoutChannels = claims.filter(claim => !claim.name.match(/^@/)); - if (myClaims.length !== claimsWithoutChannels.length) { - const pendingPublishMap = {}; - pendingPublishes.forEach(({ name }) => { - pendingPublishMap[name] = name; - }); + const checkFileList = () => { + Lbry.claim_list_mine().then(claims => { + const claimsWithoutChannels = claims.filter(claim => !claim.name.match(/^@/)); + if (myClaims.length !== claimsWithoutChannels.length) { + const pendingPublishMap = {}; + pendingPublishes.forEach(({ name }) => { + pendingPublishMap[name] = name; + }); - claims.forEach(claim => { - if (pendingPublishMap[claim.name]) { - dispatch({ - type: ACTIONS.REMOVE_PENDING_PUBLISH, - data: { - name: claim.name, - }, - }); - dispatch({ - type: ACTIONS.FETCH_CLAIM_LIST_MINE_COMPLETED, - data: { - claims, - }, - }); + claims.forEach(claim => { + if (pendingPublishMap[claim.name]) { + dispatch({ + type: ACTIONS.REMOVE_PENDING_PUBLISH, + data: { + name: claim.name, + }, + }); + dispatch({ + type: ACTIONS.FETCH_CLAIM_LIST_MINE_COMPLETED, + data: { + claims, + }, + }); - delete pendingPublishMap[claim.name]; - } - }); + delete pendingPublishMap[claim.name]; + } + }); - clearInterval(publishCheckInterval); - } - }); - }; - - if (pendingPublishes.length) { - checkFileList(); - publishCheckInterval = setInterval(() => { - checkFileList(); - }, 10000); - } + clearInterval(publishCheckInterval); + } + }); }; + + if (pendingPublishes.length) { + checkFileList(); + publishCheckInterval = setInterval(() => { + checkFileList(); + }, 10000); + } };