Skip to content

Commit

Permalink
Merge pull request Expensify#26163 from software-mansion-labs/ts-migr…
Browse files Browse the repository at this point in the history
…ation/get-plaind-oauth-received-redirect-uri

[No QA] [TS migration] Migrate 'getPlaidOAuthReceivedRedirectURI' lib to TypeScript
  • Loading branch information
aldo-expensify authored Aug 29, 2023
2 parents 430a837 + 658649f commit 0a7aabd
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 0a7aabd

Please sign in to comment.