Skip to content

Commit

Permalink
Merge pull request #5029 from Expensify/marcaaron-fixPlaid2
Browse files Browse the repository at this point in the history
Update Plaid Link for web / Fix logic breaking Plaid flow on web
  • Loading branch information
marcaaron authored Sep 2, 2021
2 parents 7de992e + 4cef8df commit 4283835
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
"react-native-unimodules": "^0.13.3",
"react-native-web": "0.15.7",
"react-pdf": "^5.2.0",
"react-plaid-link": "^3.1.0",
"react-plaid-link": "^3.2.0",
"react-web-config": "^1.0.0",
"rn-fetch-blob": "^0.12.0",
"save": "^2.4.0",
Expand Down
3 changes: 2 additions & 1 deletion src/components/AddPlaidBankAccount.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,11 @@ class AddPlaidBankAccount extends React.Component {
<ActivityIndicator color={themeColors.spinner} size="large" />
</View>
)}
{!_.isEmpty(this.props.plaidLinkToken) && _.isEmpty(this.state.institution) && (
{!_.isEmpty(this.props.plaidLinkToken) && (
<PlaidLink
token={this.props.plaidLinkToken}
onSuccess={({publicToken, metadata}) => {
console.debug('[PlaidLink] Success: ', {publicToken, metadata});
getPlaidBankAccounts(publicToken, metadata.institution.name);
this.setState({institution: metadata.institution});
}}
Expand Down
8 changes: 7 additions & 1 deletion src/components/PlaidLink/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@ const PlaidLink = (props) => {
const {open, ready, error} = usePlaidLink({
token: props.token,
onSuccess,
onExit: props.onExit,
onExit: (exitError, metadata) => {
console.debug('[PlaidLink] Exit: ', {exitError, metadata});
props.onExit();
},
onEvent: (event, metadata) => {
console.debug('[PlaidLink] Event: ', {event, metadata});
},
});

useEffect(() => {
Expand Down

0 comments on commit 4283835

Please sign in to comment.