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,
|
type: ACTIONS.WALLET_LOCK_START,
|
||||||
});
|
});
|
||||||
|
|
||||||
Lbry.wallet_lock().then(() => {
|
Lbry.wallet_lock().then(result => {
|
||||||
dispatch({
|
if (result === true) {
|
||||||
type: ACTIONS.WALLET_LOCK_COMPLETED,
|
dispatch({
|
||||||
});
|
type: ACTIONS.WALLET_LOCK_COMPLETED,
|
||||||
|
result,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
dispatch({
|
||||||
|
type: ACTIONS.WALLET_LOCK_FAILED,
|
||||||
|
result,
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ const defaultState = {
|
||||||
walletDecryptSucceded: null,
|
walletDecryptSucceded: null,
|
||||||
walletUnlockPending: false,
|
walletUnlockPending: false,
|
||||||
walletUnlockSucceded: null,
|
walletUnlockSucceded: null,
|
||||||
|
walletLockResult: null,
|
||||||
};
|
};
|
||||||
|
|
||||||
reducers[ACTIONS.FETCH_TRANSACTIONS_STARTED] = state =>
|
reducers[ACTIONS.FETCH_TRANSACTIONS_STARTED] = state =>
|
||||||
|
@ -158,54 +159,84 @@ reducers[ACTIONS.WALLET_ENCRYPT_START] = state =>
|
||||||
Object.assign({}, state, {
|
Object.assign({}, state, {
|
||||||
walletEncryptPending: true,
|
walletEncryptPending: true,
|
||||||
walletEncryptSucceded: null,
|
walletEncryptSucceded: null,
|
||||||
|
walletEncryptResult: null,
|
||||||
});
|
});
|
||||||
|
|
||||||
reducers[ACTIONS.WALLET_ENCRYPT_COMPLETED] = state =>
|
reducers[ACTIONS.WALLET_ENCRYPT_COMPLETED] = (state, action) =>
|
||||||
Object.assign({}, state, {
|
Object.assign({}, state, {
|
||||||
walletEncryptPending: false,
|
walletEncryptPending: false,
|
||||||
walletEncryptSucceded: true,
|
walletEncryptSucceded: true,
|
||||||
|
walletEncryptResult: action.result,
|
||||||
});
|
});
|
||||||
|
|
||||||
reducers[ACTIONS.WALLET_ENCRYPT_FAILED] = state =>
|
reducers[ACTIONS.WALLET_ENCRYPT_FAILED] = (state, action) =>
|
||||||
Object.assign({}, state, {
|
Object.assign({}, state, {
|
||||||
walletEncryptPending: false,
|
walletEncryptPending: false,
|
||||||
walletEncryptSucceded: false,
|
walletEncryptSucceded: false,
|
||||||
|
walletEncryptResult: action.result,
|
||||||
});
|
});
|
||||||
|
|
||||||
reducers[ACTIONS.WALLET_DECRYPT_START] = state =>
|
reducers[ACTIONS.WALLET_DECRYPT_START] = state =>
|
||||||
Object.assign({}, state, {
|
Object.assign({}, state, {
|
||||||
walletDecryptPending: true,
|
walletDecryptPending: true,
|
||||||
walletDecryptSucceded: null,
|
walletDecryptSucceded: null,
|
||||||
|
walletDecryptResult: null,
|
||||||
});
|
});
|
||||||
|
|
||||||
reducers[ACTIONS.WALLET_DECRYPT_COMPLETED] = state =>
|
reducers[ACTIONS.WALLET_DECRYPT_COMPLETED] = (state, action) =>
|
||||||
Object.assign({}, state, {
|
Object.assign({}, state, {
|
||||||
walletDecryptPending: false,
|
walletDecryptPending: false,
|
||||||
walletDecryptSucceded: true,
|
walletDecryptSucceded: true,
|
||||||
|
walletDecryptResult: action.result,
|
||||||
});
|
});
|
||||||
|
|
||||||
reducers[ACTIONS.WALLET_DECRYPT_FAILED] = state =>
|
reducers[ACTIONS.WALLET_DECRYPT_FAILED] = (state, action) =>
|
||||||
Object.assign({}, state, {
|
Object.assign({}, state, {
|
||||||
walletDecryptPending: false,
|
walletDecryptPending: false,
|
||||||
walletDecryptSucceded: false,
|
walletDecryptSucceded: false,
|
||||||
|
walletDecryptResult: action.result,
|
||||||
});
|
});
|
||||||
|
|
||||||
reducers[ACTIONS.WALLET_UNLOCK_START] = state =>
|
reducers[ACTIONS.WALLET_UNLOCK_START] = state =>
|
||||||
Object.assign({}, state, {
|
Object.assign({}, state, {
|
||||||
walletUnlockPending: true,
|
walletUnlockPending: true,
|
||||||
walletUnlockSucceded: null,
|
walletUnlockSucceded: null,
|
||||||
|
walletUnlockResult: null,
|
||||||
});
|
});
|
||||||
|
|
||||||
reducers[ACTIONS.WALLET_UNLOCK_COMPLETED] = state =>
|
reducers[ACTIONS.WALLET_UNLOCK_COMPLETED] = (state, action) =>
|
||||||
Object.assign({}, state, {
|
Object.assign({}, state, {
|
||||||
walletUnlockPending: false,
|
walletUnlockPending: false,
|
||||||
walletUnlockSucceded: true,
|
walletUnlockSucceded: true,
|
||||||
|
walletUnlockResult: action.result,
|
||||||
});
|
});
|
||||||
|
|
||||||
reducers[ACTIONS.WALLET_UNLOCK_FAILED] = state =>
|
reducers[ACTIONS.WALLET_UNLOCK_FAILED] = (state, action) =>
|
||||||
Object.assign({}, state, {
|
Object.assign({}, state, {
|
||||||
walletUnlockPending: false,
|
walletUnlockPending: false,
|
||||||
walletUnlockSucceded: 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) {
|
export function walletReducer(state = defaultState, action) {
|
||||||
|
|
|
@ -17,6 +17,11 @@ export const selectWalletEncryptSucceeded = createSelector(
|
||||||
state => state.walletEncryptSucceded
|
state => state.walletEncryptSucceded
|
||||||
);
|
);
|
||||||
|
|
||||||
|
export const selectWalletEncryptResult = createSelector(
|
||||||
|
selectState,
|
||||||
|
state => state.walletEncryptResult
|
||||||
|
);
|
||||||
|
|
||||||
export const selectWalletDecryptPending = createSelector(
|
export const selectWalletDecryptPending = createSelector(
|
||||||
selectState,
|
selectState,
|
||||||
state => state.walletDecryptPending
|
state => state.walletDecryptPending
|
||||||
|
@ -27,6 +32,11 @@ export const selectWalletDecryptSucceeded = createSelector(
|
||||||
state => state.walletDecryptSucceded
|
state => state.walletDecryptSucceded
|
||||||
);
|
);
|
||||||
|
|
||||||
|
export const selectWalletDecryptResult = createSelector(
|
||||||
|
selectState,
|
||||||
|
state => state.walletDecryptResult
|
||||||
|
);
|
||||||
|
|
||||||
export const selectWalletUnlockPending = createSelector(
|
export const selectWalletUnlockPending = createSelector(
|
||||||
selectState,
|
selectState,
|
||||||
state => state.walletUnlockPending
|
state => state.walletUnlockPending
|
||||||
|
@ -37,6 +47,23 @@ export const selectWalletUnlockSucceeded = createSelector(
|
||||||
state => state.walletUnlockSucceded
|
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 selectBalance = createSelector(selectState, state => state.balance);
|
||||||
|
|
||||||
export const selectTransactionsById = createSelector(selectState, state => state.transactions);
|
export const selectTransactionsById = createSelector(selectState, state => state.transactions);
|
||||||
|
|
Loading…
Add table
Reference in a new issue