Skip to content

Commit

Permalink
Merge pull request #27248 from software-mansion-labs/ts-migration/add…
Browse files Browse the repository at this point in the history
…EncryptedAuthTokenToURL

[No QA][TS migration] Migrate 'addEncryptedAuthTokenToURL.js' lib to TypeScript
  • Loading branch information
arosiclair authored Sep 13, 2023
2 parents 6c6b3ad + 650f42a commit 174f636
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
import lodashGet from 'lodash/get';
import Onyx from 'react-native-onyx';
import ONYXKEYS from '../ONYXKEYS';

let encryptedAuthToken = '';
Onyx.connect({
key: ONYXKEYS.SESSION,
callback: (session) => (encryptedAuthToken = lodashGet(session, 'encryptedAuthToken', '')),
callback: (session) => (encryptedAuthToken = session?.encryptedAuthToken ?? ''),
});

/**
* Add encryptedAuthToken to this attachment URL
*
* @param {String} url
* @returns {String}
*/
export default function (url) {
export default function (url: string) {
return `${url}?encryptedAuthToken=${encodeURIComponent(encryptedAuthToken)}`;
}

0 comments on commit 174f636

Please sign in to comment.