Skip to content

Commit

Permalink
refactor(parameters): Default parameters should be last.sonarlint(typ…
Browse files Browse the repository at this point in the history
…escript:S1788)
  • Loading branch information
jafin committed Jul 21, 2024
1 parent 7b5f241 commit 5e47636
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/oidc-client/src/renewTokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ async function syncTokens(oidc: Oidc, forceRefresh: boolean, extras: StringMap)
oidc.tokens = tokens;
};
const { tokens, status } = await synchroniseTokensAsync(oidc)(
updateTokens,
0,
forceRefresh,
extras,
updateTokens,
);

const serviceWorker = await initWorkerAsync(oidc.configuration, oidc.configurationName);
Expand Down Expand Up @@ -200,7 +200,7 @@ export const syncTokensInfoAsync =

const synchroniseTokensAsync =
(oidc: Oidc) =>
async (index = 0, forceRefresh = false, extras: StringMap = null, updateTokens) => {
async (updateTokens, index = 0, forceRefresh = false, extras: StringMap = null) => {
if (!navigator.onLine && document.hidden) {
return { tokens: oidc.tokens, status: 'GIVE_UP' };
}
Expand Down Expand Up @@ -264,7 +264,7 @@ const synchroniseTokensAsync =
message: 'exceptionSilent',
exception: exceptionSilent.message,
});
return await synchroniseTokensAsync(oidc)(nextIndex, forceRefresh, extras, updateTokens);
return await synchroniseTokensAsync(oidc)(updateTokens, nextIndex, forceRefresh, extras);
}
};

Expand Down Expand Up @@ -422,10 +422,10 @@ const synchroniseTokensAsync =
}

return await synchroniseTokensAsync(oidc)(
updateTokens,
nextIndex,
forceRefresh,
extras,
updateTokens,
);
}
};
Expand All @@ -443,7 +443,7 @@ const synchroniseTokensAsync =
// so we need to brake calls chain and delay next call
return new Promise((resolve, reject) => {
setTimeout(() => {
synchroniseTokensAsync(oidc)(nextIndex, forceRefresh, extras, updateTokens)
synchroniseTokensAsync(oidc)(updateTokens, nextIndex, forceRefresh, extras)
.then(resolve)
.catch(reject);
}, 1000);
Expand Down

0 comments on commit 5e47636

Please sign in to comment.