add doDeletePurchasedUri action
This commit is contained in:
parent
5cff70a26b
commit
071bfe9eac
7 changed files with 63 additions and 3 deletions
22
dist/bundle.es.js
vendored
22
dist/bundle.es.js
vendored
|
@ -119,6 +119,7 @@ const SET_FILE_LIST_SORT = 'SET_FILE_LIST_SORT';
|
|||
const PURCHASE_URI_STARTED = 'PURCHASE_URI_STARTED';
|
||||
const PURCHASE_URI_COMPLETED = 'PURCHASE_URI_COMPLETED';
|
||||
const PURCHASE_URI_FAILED = 'PURCHASE_URI_FAILED';
|
||||
const DELETE_PURCHASED_URI = 'DELETE_PURCHASED_URI';
|
||||
const LOADING_FILE_STARTED = 'LOADING_FILE_STARTED';
|
||||
const LOADING_FILE_COMPLETED = 'LOADING_FILE_COMPLETED';
|
||||
const LOADING_FILE_FAILED = 'LOADING_FILE_FAILED';
|
||||
|
@ -341,6 +342,7 @@ var action_types = /*#__PURE__*/Object.freeze({
|
|||
PURCHASE_URI_STARTED: PURCHASE_URI_STARTED,
|
||||
PURCHASE_URI_COMPLETED: PURCHASE_URI_COMPLETED,
|
||||
PURCHASE_URI_FAILED: PURCHASE_URI_FAILED,
|
||||
DELETE_PURCHASED_URI: DELETE_PURCHASED_URI,
|
||||
LOADING_FILE_STARTED: LOADING_FILE_STARTED,
|
||||
LOADING_FILE_COMPLETED: LOADING_FILE_COMPLETED,
|
||||
LOADING_FILE_FAILED: LOADING_FILE_FAILED,
|
||||
|
@ -2417,6 +2419,13 @@ function doPurchaseUri(uri, costInfo, saveFile = true) {
|
|||
};
|
||||
}
|
||||
|
||||
function doDeletePurchasedUri(uri) {
|
||||
return {
|
||||
type: DELETE_PURCHASED_URI,
|
||||
data: { uri }
|
||||
};
|
||||
}
|
||||
|
||||
function doFetchFileInfo(uri) {
|
||||
return (dispatch, getState) => {
|
||||
const state = getState();
|
||||
|
@ -2964,6 +2973,18 @@ reducers$1[PURCHASE_URI_FAILED] = (state, action) => {
|
|||
});
|
||||
};
|
||||
|
||||
reducers$1[DELETE_PURCHASED_URI] = (state, action) => {
|
||||
const { uri } = action.data;
|
||||
const newPurchasedUris = state.purchasedUris.slice();
|
||||
if (newPurchasedUris.includes(uri)) {
|
||||
newPurchasedUris.splice(newPurchasedUris.indexOf(uri), 1);
|
||||
}
|
||||
|
||||
return _extends$4({}, state, {
|
||||
purchasedUris: newPurchasedUris
|
||||
});
|
||||
};
|
||||
|
||||
function fileReducer(state = defaultState$1, action) {
|
||||
const handler = reducers$1[action.type];
|
||||
if (handler) return handler(state, action);
|
||||
|
@ -3663,6 +3684,7 @@ exports.doBalanceSubscribe = doBalanceSubscribe;
|
|||
exports.doBlurSearchInput = doBlurSearchInput;
|
||||
exports.doCheckAddressIsMine = doCheckAddressIsMine;
|
||||
exports.doCreateChannel = doCreateChannel;
|
||||
exports.doDeletePurchasedUri = doDeletePurchasedUri;
|
||||
exports.doDismissError = doDismissError;
|
||||
exports.doDismissToast = doDismissToast;
|
||||
exports.doError = doError;
|
||||
|
|
9
dist/flow-typed/File.js
vendored
9
dist/flow-typed/File.js
vendored
|
@ -62,4 +62,11 @@ declare type PurchaseUriStarted = {
|
|||
uri: string,
|
||||
streamingUrl: string,
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
declare type DeletePurchasedUri = {
|
||||
type: ACTIONS.DELETE_PURCHASED_URI,
|
||||
data: {
|
||||
uri: string
|
||||
},
|
||||
};
|
||||
|
|
9
flow-typed/File.js
vendored
9
flow-typed/File.js
vendored
|
@ -62,4 +62,11 @@ declare type PurchaseUriStarted = {
|
|||
uri: string,
|
||||
streamingUrl: string,
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
declare type DeletePurchasedUri = {
|
||||
type: ACTIONS.DELETE_PURCHASED_URI,
|
||||
data: {
|
||||
uri: string
|
||||
},
|
||||
};
|
||||
|
|
|
@ -109,6 +109,7 @@ export const SET_FILE_LIST_SORT = 'SET_FILE_LIST_SORT';
|
|||
export const PURCHASE_URI_STARTED = 'PURCHASE_URI_STARTED';
|
||||
export const PURCHASE_URI_COMPLETED = 'PURCHASE_URI_COMPLETED';
|
||||
export const PURCHASE_URI_FAILED = 'PURCHASE_URI_FAILED';
|
||||
export const DELETE_PURCHASED_URI = 'DELETE_PURCHASED_URI';
|
||||
export const LOADING_FILE_STARTED = 'LOADING_FILE_STARTED';
|
||||
export const LOADING_FILE_COMPLETED = 'LOADING_FILE_COMPLETED';
|
||||
export const LOADING_FILE_FAILED = 'LOADING_FILE_FAILED';
|
||||
|
|
|
@ -47,7 +47,7 @@ export {
|
|||
doCreateChannel,
|
||||
} from 'redux/actions/claims';
|
||||
|
||||
export { doPurchaseUri, doFileGet } from 'redux/actions/file';
|
||||
export { doDeletePurchasedUri, doPurchaseUri, doFileGet } from 'redux/actions/file';
|
||||
|
||||
export {
|
||||
doFetchFileInfo,
|
||||
|
|
|
@ -102,3 +102,10 @@ export function doPurchaseUri(uri: string, costInfo: { cost: number }, saveFile:
|
|||
dispatch(doFileGet(uri, saveFile));
|
||||
};
|
||||
}
|
||||
|
||||
export function doDeletePurchasedUri(uri: string) {
|
||||
return {
|
||||
type: ACTIONS.DELETE_PURCHASED_URI,
|
||||
data: { uri },
|
||||
};
|
||||
}
|
||||
|
|
|
@ -67,6 +67,22 @@ reducers[ACTIONS.PURCHASE_URI_FAILED] = (
|
|||
};
|
||||
};
|
||||
|
||||
reducers[ACTIONS.DELETE_PURCHASED_URI] = (
|
||||
state: FileState,
|
||||
action: DeletePurchasedUri
|
||||
): FileState => {
|
||||
const { uri } = action.data;
|
||||
const newPurchasedUris = state.purchasedUris.slice();
|
||||
if (newPurchasedUris.includes(uri)) {
|
||||
newPurchasedUris.splice(newPurchasedUris.indexOf(uri), 1);
|
||||
}
|
||||
|
||||
return {
|
||||
...state,
|
||||
purchasedUris: newPurchasedUris,
|
||||
};
|
||||
};
|
||||
|
||||
export function fileReducer(state: FileState = defaultState, action: any) {
|
||||
const handler = reducers[action.type];
|
||||
if (handler) return handler(state, action);
|
||||
|
|
Loading…
Reference in a new issue