Skip to content

Commit

Permalink
Clearing interactionToken state in case sending the reposne fails
Browse files Browse the repository at this point in the history
  • Loading branch information
Exulansis committed May 8, 2019
1 parent 14f42db commit 172d7b8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/actions/sso/authenticationRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down Expand Up @@ -83,6 +83,7 @@ export const sendAuthenticationResponse = () => async (
}
} catch (err) {
console.log(err)
dispatch(clearInteractionRequest())
dispatch(showErrorScreen(new Error('Sending payment response failed.')))
}
}
1 change: 1 addition & 0 deletions src/actions/sso/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@ export const sendCredentialResponse = (
}
} catch (error) {
// TODO: better error message
dispatch(clearInteractionRequest())
console.log(error)
dispatch(accountActions.toggleLoading(false))
dispatch(
Expand Down
3 changes: 2 additions & 1 deletion src/actions/sso/paymentRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) => ({
Expand Down Expand Up @@ -92,6 +92,7 @@ export const sendPaymentResponse = () => async (
}
} catch (err) {
console.log(err)
dispatch(clearInteractionRequest())
dispatch(showErrorScreen(new Error('Sending payment response failed.')))
}
}

0 comments on commit 172d7b8

Please sign in to comment.