add preview action

This commit is contained in:
jessop 2020-04-01 14:36:11 -04:00
parent de41f6bb8e
commit 1097a63d44
4 changed files with 34 additions and 6 deletions

20
dist/bundle.es.js vendored
View file

@ -65,6 +65,7 @@ const ABANDON_SUPPORT_COMPLETED = 'ABANDON_SUPPORT_COMPLETED';
const ABANDON_CLAIM_SUPPORT_STARTED = 'ABANDON_CLAIM_SUPPORT_STARTED';
const ABANDON_CLAIM_SUPPORT_COMPLETED = 'ABANDON_CLAIM_SUPPORT_COMPLETED';
const ABANDON_CLAIM_SUPPORT_FAILED = 'ABANDON_CLAIM_SUPPORT_FAILED';
const ABANDON_CLAIM_SUPPORT_PREVIEW = 'ABANDON_CLAIM_SUPPORT_PREVIEW';
const PENDING_SUPPORTS_UPDATED = 'PENDING_SUPPORTS_UPDATED';
const UPDATE_BALANCE = 'UPDATE_BALANCE';
const UPDATE_TOTAL_BALANCE = 'UPDATE_TOTAL_BALANCE';
@ -334,6 +335,7 @@ var action_types = /*#__PURE__*/Object.freeze({
ABANDON_CLAIM_SUPPORT_STARTED: ABANDON_CLAIM_SUPPORT_STARTED,
ABANDON_CLAIM_SUPPORT_COMPLETED: ABANDON_CLAIM_SUPPORT_COMPLETED,
ABANDON_CLAIM_SUPPORT_FAILED: ABANDON_CLAIM_SUPPORT_FAILED,
ABANDON_CLAIM_SUPPORT_PREVIEW: ABANDON_CLAIM_SUPPORT_PREVIEW,
PENDING_SUPPORTS_UPDATED: PENDING_SUPPORTS_UPDATED,
UPDATE_BALANCE: UPDATE_BALANCE,
UPDATE_TOTAL_BALANCE: UPDATE_TOTAL_BALANCE,
@ -2823,9 +2825,15 @@ function doWalletUnlock(password) {
function doSupportAbandonForClaim(claimId, claimType, keep, preview) {
return dispatch => {
dispatch({
type: ABANDON_CLAIM_SUPPORT_STARTED
});
if (preview) {
dispatch({
type: ABANDON_CLAIM_SUPPORT_PREVIEW
});
} else {
dispatch({
type: ABANDON_CLAIM_SUPPORT_STARTED
});
}
const params = { claim_id: claimId };
if (preview) params['preview'] = true;
@ -5990,6 +5998,12 @@ const walletReducer = handleActions({
});
},
[ABANDON_CLAIM_SUPPORT_PREVIEW]: (state, action) => {
return _extends$i({}, state, {
abandonClaimSupportError: undefined
});
},
[ABANDON_CLAIM_SUPPORT_COMPLETED]: (state, action) => {
const { claimId, type, txid, effective } = action.data;
const pendingtxs = Object.assign({}, state.pendingSupportTransactions);

View file

@ -42,6 +42,7 @@ export const ABANDON_SUPPORT_COMPLETED = 'ABANDON_SUPPORT_COMPLETED';
export const ABANDON_CLAIM_SUPPORT_STARTED = 'ABANDON_CLAIM_SUPPORT_STARTED';
export const ABANDON_CLAIM_SUPPORT_COMPLETED = 'ABANDON_CLAIM_SUPPORT_COMPLETED';
export const ABANDON_CLAIM_SUPPORT_FAILED = 'ABANDON_CLAIM_SUPPORT_FAILED';
export const ABANDON_CLAIM_SUPPORT_PREVIEW = 'ABANDON_CLAIM_SUPPORT_PREVIEW';
export const PENDING_SUPPORTS_UPDATED = 'PENDING_SUPPORTS_UPDATED';
export const UPDATE_BALANCE = 'UPDATE_BALANCE';
export const UPDATE_TOTAL_BALANCE = 'UPDATE_TOTAL_BALANCE';

View file

@ -345,9 +345,15 @@ export function doWalletLock() {
export function doSupportAbandonForClaim(claimId, claimType, keep, preview) {
return dispatch => {
dispatch({
type: ACTIONS.ABANDON_CLAIM_SUPPORT_STARTED,
});
if (preview) {
dispatch({
type: ACTIONS.ABANDON_CLAIM_SUPPORT_PREVIEW,
});
} else {
dispatch({
type: ACTIONS.ABANDON_CLAIM_SUPPORT_STARTED,
});
}
const params = {claim_id: claimId};
if (preview) params['preview'] = true;

View file

@ -157,6 +157,13 @@ export const walletReducer = handleActions(
};
},
[ACTIONS.ABANDON_CLAIM_SUPPORT_PREVIEW]: (state: WalletState, action: any): WalletState => {
return {
...state,
abandonClaimSupportError: undefined,
};
},
[ACTIONS.ABANDON_CLAIM_SUPPORT_COMPLETED]: (state: WalletState, action: any): WalletState => {
const { claimId, type, txid, effective }: { claimId: string, type: string, txid: string, effective: string } = action.data;
const pendingtxs = Object.assign({}, state.pendingSupportTransactions);