Skip to content

Commit

Permalink
chore: debounce refreshAuthTokens
Browse files Browse the repository at this point in the history
  • Loading branch information
israx committed Jan 12, 2024
1 parent 4bbeba0 commit e3df8aa
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { assertAuthTokensWithRefreshToken } from '../utils/types';
import { AuthError } from '../../../errors/AuthError';
import { getUserContextData } from './userContextData';

export const refreshAuthTokens: TokenRefresher = async ({
const refreshAuthTokensCallback: TokenRefresher = async ({
tokens,
authConfig,
username,
Expand All @@ -41,8 +41,7 @@ export const refreshAuthTokens: TokenRefresher = async ({
userPoolClientId: authConfig.Cognito.userPoolClientId,
});

const deDuplicatedInitiateAuth = deDupCallback(initiateAuth);
const { AuthenticationResult } = await deDuplicatedInitiateAuth(
const { AuthenticationResult } = await initiateAuth(
{ region },
{
ClientId: authConfig?.Cognito?.userPoolClientId,
Expand Down Expand Up @@ -74,3 +73,5 @@ export const refreshAuthTokens: TokenRefresher = async ({
username,
};
};

export const refreshAuthTokens = deDupCallback(refreshAuthTokensCallback);

0 comments on commit e3df8aa

Please sign in to comment.