Skip to content

Commit

Permalink
[TS migration] Migrate 'getPlaidOAuthReceivedRedirectURI' lib to Type…
Browse files Browse the repository at this point in the history
…Script
  • Loading branch information
BartoszGrajdek committed Aug 29, 2023
1 parent fd755ee commit 658649f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
1 change: 0 additions & 1 deletion src/libs/getPlaidOAuthReceivedRedirectURI/index.native.js

This file was deleted.

5 changes: 5 additions & 0 deletions src/libs/getPlaidOAuthReceivedRedirectURI/index.native.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import GetPlaidOAuthReceivedRedirectURI from './types';

const getPlaidOAuthReceivedRedirectURI: GetPlaidOAuthReceivedRedirectURI = () => null;

export default getPlaidOAuthReceivedRedirectURI;
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import GetPlaidOAuthReceivedRedirectURI from './types';

/**
* After a user authenticates their bank in the Plaid OAuth flow, Plaid returns us to the redirectURI we
* gave them along with a stateID param. We hand off the receivedRedirectUri to PlaidLink to finish connecting
* the user's account.
* @returns {String | null}
*/
export default () => {
const getPlaidOAuthReceivedRedirectURI: GetPlaidOAuthReceivedRedirectURI = () => {
const receivedRedirectURI = window.location.href;
const receivedRedirectSearchParams = new URL(window.location.href).searchParams;
const oauthStateID = receivedRedirectSearchParams.get('oauth_state_id');
Expand All @@ -15,3 +16,5 @@ export default () => {
}
return receivedRedirectURI;
};

export default getPlaidOAuthReceivedRedirectURI;
3 changes: 3 additions & 0 deletions src/libs/getPlaidOAuthReceivedRedirectURI/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
type GetPlaidOAuthReceivedRedirectURI = () => null | string;

export default GetPlaidOAuthReceivedRedirectURI;

0 comments on commit 658649f

Please sign in to comment.