From 7c8ffadd263b76ad3bd06ba29866108d2cfec149 Mon Sep 17 00:00:00 2001 From: Exulansis Date: Wed, 8 May 2019 12:59:20 +0200 Subject: [PATCH] Clearing interactionToken state in case sending the reposne fails --- src/actions/sso/authenticationRequest.ts | 3 ++- src/actions/sso/index.ts | 1 + src/actions/sso/paymentRequest.ts | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/actions/sso/authenticationRequest.ts b/src/actions/sso/authenticationRequest.ts index c124d3d921..7719e66924 100644 --- a/src/actions/sso/authenticationRequest.ts +++ b/src/actions/sso/authenticationRequest.ts @@ -6,7 +6,7 @@ import { showErrorScreen } from 'src/actions/generic' import { Authentication } from 'jolocom-lib/js/interactionTokens/authentication' import { StateAuthenticationRequestSummary } from 'src/reducers/sso' import { routeList } from 'src/routeList' -import { cancelSSO } from '.' +import {cancelSSO, clearInteractionRequest} from '.' import { Linking } from 'react-native' import { JolocomLib } from 'jolocom-lib' @@ -83,6 +83,7 @@ export const sendAuthenticationResponse = () => async ( } } catch (err) { console.log(err) + dispatch(clearInteractionRequest()) dispatch(showErrorScreen(new Error('Sending payment response failed.'))) } } diff --git a/src/actions/sso/index.ts b/src/actions/sso/index.ts index 038a86ea0f..ec98452496 100644 --- a/src/actions/sso/index.ts +++ b/src/actions/sso/index.ts @@ -337,6 +337,7 @@ export const sendCredentialResponse = ( } } catch (error) { // TODO: better error message + dispatch(clearInteractionRequest()) console.log(error) dispatch(accountActions.toggleLoading(false)) dispatch( diff --git a/src/actions/sso/paymentRequest.ts b/src/actions/sso/paymentRequest.ts index 029c1d8165..0ef2ccbe81 100644 --- a/src/actions/sso/paymentRequest.ts +++ b/src/actions/sso/paymentRequest.ts @@ -8,7 +8,7 @@ import { StatePaymentRequestSummary } from 'src/reducers/sso' import { showErrorScreen } from 'src/actions/generic' import { JolocomLib } from 'jolocom-lib' import { Linking } from 'react-native' -import { cancelSSO } from 'src/actions/sso' +import {cancelSSO, clearInteractionRequest} from 'src/actions/sso' import { JolocomRegistry } from 'jolocom-lib/js/registries/jolocomRegistry' export const setPaymentRequest = (request: StatePaymentRequestSummary) => ({ @@ -92,6 +92,7 @@ export const sendPaymentResponse = () => async ( } } catch (err) { console.log(err) + dispatch(clearInteractionRequest()) dispatch(showErrorScreen(new Error('Sending payment response failed.'))) } }