Make adjustments
This commit is contained in:
parent
188ff62724
commit
acbb4d247b
3 changed files with 76 additions and 10 deletions
|
@ -293,10 +293,18 @@ export function doWalletLock() {
|
|||
type: ACTIONS.WALLET_LOCK_START,
|
||||
});
|
||||
|
||||
Lbry.wallet_lock().then(() => {
|
||||
dispatch({
|
||||
type: ACTIONS.WALLET_LOCK_COMPLETED,
|
||||
});
|
||||
Lbry.wallet_lock().then(result => {
|
||||
if (result === true) {
|
||||
dispatch({
|
||||
type: ACTIONS.WALLET_LOCK_COMPLETED,
|
||||
result,
|
||||
});
|
||||
} else {
|
||||
dispatch({
|
||||
type: ACTIONS.WALLET_LOCK_FAILED,
|
||||
result,
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ const defaultState = {
|
|||
walletDecryptSucceded: null,
|
||||
walletUnlockPending: false,
|
||||
walletUnlockSucceded: null,
|
||||
walletLockResult: null,
|
||||
};
|
||||
|
||||
reducers[ACTIONS.FETCH_TRANSACTIONS_STARTED] = state =>
|
||||
|
@ -158,54 +159,84 @@ reducers[ACTIONS.WALLET_ENCRYPT_START] = state =>
|
|||
Object.assign({}, state, {
|
||||
walletEncryptPending: true,
|
||||
walletEncryptSucceded: null,
|
||||
walletEncryptResult: null,
|
||||
});
|
||||
|
||||
reducers[ACTIONS.WALLET_ENCRYPT_COMPLETED] = state =>
|
||||
reducers[ACTIONS.WALLET_ENCRYPT_COMPLETED] = (state, action) =>
|
||||
Object.assign({}, state, {
|
||||
walletEncryptPending: false,
|
||||
walletEncryptSucceded: true,
|
||||
walletEncryptResult: action.result,
|
||||
});
|
||||
|
||||
reducers[ACTIONS.WALLET_ENCRYPT_FAILED] = state =>
|
||||
reducers[ACTIONS.WALLET_ENCRYPT_FAILED] = (state, action) =>
|
||||
Object.assign({}, state, {
|
||||
walletEncryptPending: false,
|
||||
walletEncryptSucceded: false,
|
||||
walletEncryptResult: action.result,
|
||||
});
|
||||
|
||||
reducers[ACTIONS.WALLET_DECRYPT_START] = state =>
|
||||
Object.assign({}, state, {
|
||||
walletDecryptPending: true,
|
||||
walletDecryptSucceded: null,
|
||||
walletDecryptResult: null,
|
||||
});
|
||||
|
||||
reducers[ACTIONS.WALLET_DECRYPT_COMPLETED] = state =>
|
||||
reducers[ACTIONS.WALLET_DECRYPT_COMPLETED] = (state, action) =>
|
||||
Object.assign({}, state, {
|
||||
walletDecryptPending: false,
|
||||
walletDecryptSucceded: true,
|
||||
walletDecryptResult: action.result,
|
||||
});
|
||||
|
||||
reducers[ACTIONS.WALLET_DECRYPT_FAILED] = state =>
|
||||
reducers[ACTIONS.WALLET_DECRYPT_FAILED] = (state, action) =>
|
||||
Object.assign({}, state, {
|
||||
walletDecryptPending: false,
|
||||
walletDecryptSucceded: false,
|
||||
walletDecryptResult: action.result,
|
||||
});
|
||||
|
||||
reducers[ACTIONS.WALLET_UNLOCK_START] = state =>
|
||||
Object.assign({}, state, {
|
||||
walletUnlockPending: true,
|
||||
walletUnlockSucceded: null,
|
||||
walletUnlockResult: null,
|
||||
});
|
||||
|
||||
reducers[ACTIONS.WALLET_UNLOCK_COMPLETED] = state =>
|
||||
reducers[ACTIONS.WALLET_UNLOCK_COMPLETED] = (state, action) =>
|
||||
Object.assign({}, state, {
|
||||
walletUnlockPending: false,
|
||||
walletUnlockSucceded: true,
|
||||
walletUnlockResult: action.result,
|
||||
});
|
||||
|
||||
reducers[ACTIONS.WALLET_UNLOCK_FAILED] = state =>
|
||||
reducers[ACTIONS.WALLET_UNLOCK_FAILED] = (state, action) =>
|
||||
Object.assign({}, state, {
|
||||
walletUnlockPending: false,
|
||||
walletUnlockSucceded: false,
|
||||
walletUnlockResult: action.result,
|
||||
});
|
||||
|
||||
reducers[ACTIONS.WALLET_LOCK_START] = state =>
|
||||
Object.assign({}, state, {
|
||||
walletLockPending: false,
|
||||
walletLockSucceded: null,
|
||||
walletLockResult: null,
|
||||
});
|
||||
|
||||
reducers[ACTIONS.WALLET_LOCK_COMPLETED] = (state, action) =>
|
||||
Object.assign({}, state, {
|
||||
walletLockPending: false,
|
||||
walletLockSucceded: true,
|
||||
walletLockResult: action.result,
|
||||
});
|
||||
|
||||
reducers[ACTIONS.WALLET_LOCK_FAILED] = (state, action) =>
|
||||
Object.assign({}, state, {
|
||||
walletLockPending: false,
|
||||
walletLockSucceded: false,
|
||||
walletLockResult: action.result,
|
||||
});
|
||||
|
||||
export function walletReducer(state = defaultState, action) {
|
||||
|
|
|
@ -17,6 +17,11 @@ export const selectWalletEncryptSucceeded = createSelector(
|
|||
state => state.walletEncryptSucceded
|
||||
);
|
||||
|
||||
export const selectWalletEncryptResult = createSelector(
|
||||
selectState,
|
||||
state => state.walletEncryptResult
|
||||
);
|
||||
|
||||
export const selectWalletDecryptPending = createSelector(
|
||||
selectState,
|
||||
state => state.walletDecryptPending
|
||||
|
@ -27,6 +32,11 @@ export const selectWalletDecryptSucceeded = createSelector(
|
|||
state => state.walletDecryptSucceded
|
||||
);
|
||||
|
||||
export const selectWalletDecryptResult = createSelector(
|
||||
selectState,
|
||||
state => state.walletDecryptResult
|
||||
);
|
||||
|
||||
export const selectWalletUnlockPending = createSelector(
|
||||
selectState,
|
||||
state => state.walletUnlockPending
|
||||
|
@ -37,6 +47,23 @@ export const selectWalletUnlockSucceeded = createSelector(
|
|||
state => state.walletUnlockSucceded
|
||||
);
|
||||
|
||||
export const selectWalletUnlockResult = createSelector(
|
||||
selectState,
|
||||
state => state.walletUnlockResult
|
||||
);
|
||||
|
||||
export const selectWalletLockPending = createSelector(
|
||||
selectState,
|
||||
state => state.walletLockPending
|
||||
);
|
||||
|
||||
export const selectWalletLockSucceeded = createSelector(
|
||||
selectState,
|
||||
state => state.walletLockSucceded
|
||||
);
|
||||
|
||||
export const selectWalletLockResult = createSelector(selectState, state => state.walletLockResult);
|
||||
|
||||
export const selectBalance = createSelector(selectState, state => state.balance);
|
||||
|
||||
export const selectTransactionsById = createSelector(selectState, state => state.transactions);
|
||||
|
|
Loading…
Reference in a new issue