From 954ad18f8e0b7f134995687657fb1764c5cb89b1 Mon Sep 17 00:00:00 2001 From: Vladimir Volek Date: Fri, 19 Oct 2018 00:55:16 +0200 Subject: [PATCH] Clear for signature --- src/actions/SignVerifyActions.js | 9 ++++++++- src/actions/constants/signVerify.js | 3 ++- src/reducers/SignVerifyReducer.js | 7 ++++++- src/views/Wallet/views/Account/SignVerify/index.js | 1 + 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/actions/SignVerifyActions.js b/src/actions/SignVerifyActions.js index 99e734ac..9ce9d754 100644 --- a/src/actions/SignVerifyActions.js +++ b/src/actions/SignVerifyActions.js @@ -62,7 +62,6 @@ export const verify = ( signature, hex, }; - console.log('input', input); const response = await TrezorConnect.ethereumVerifyMessage(input); if (response && response.success) { @@ -89,4 +88,12 @@ export const verify = ( }, }); } +}; + + +export const clear = (): ThunkAction => (dispatch: Dispatch): void => { + dispatch({ + type: SIGN_VERIFY.CLEAR, + signature: '', + }); }; \ No newline at end of file diff --git a/src/actions/constants/signVerify.js b/src/actions/constants/signVerify.js index 3e1d8838..b0b11fc1 100644 --- a/src/actions/constants/signVerify.js +++ b/src/actions/constants/signVerify.js @@ -1,4 +1,5 @@ /* @flow */ export const SIGN_SUCCESS: 'sign__verify__sign__success' = 'sign__verify__sign__success'; -export const VERIFY_SUCCESS: 'sign__verify__verify__success' = 'sign__verify__verify__success'; \ No newline at end of file +export const VERIFY_SUCCESS: 'sign__verify__verify__success' = 'sign__verify__verify__success'; +export const CLEAR: 'sign__verify__sign__clear' = 'sign__verify__sign__clear'; \ No newline at end of file diff --git a/src/reducers/SignVerifyReducer.js b/src/reducers/SignVerifyReducer.js index 2a1f1287..0fcbedbb 100644 --- a/src/reducers/SignVerifyReducer.js +++ b/src/reducers/SignVerifyReducer.js @@ -11,7 +11,7 @@ export type State = { } export const initialState: State = { - signature: null, + signature: '', }; export default (state: State = initialState, action: Action): State => { @@ -28,6 +28,11 @@ export default (state: State = initialState, action: Action): State => { signature: action.signature, }; + case SIGN_VERIFY.CLEAR: + return { + ...initialState, + }; + default: return state; } diff --git a/src/views/Wallet/views/Account/SignVerify/index.js b/src/views/Wallet/views/Account/SignVerify/index.js index a3e93fc6..92c5b884 100644 --- a/src/views/Wallet/views/Account/SignVerify/index.js +++ b/src/views/Wallet/views/Account/SignVerify/index.js @@ -80,6 +80,7 @@ class SignVerify extends Component { this.setState({ signMessage: '', }); + this.props.signVerifyActions.clear(); } clearVerify = () => {