()
| 12 | * Only one tab performs the refresh; others wait for completion. |
| 13 | */ |
| 14 | export async function refreshTokens(): Promise<void> { |
| 15 | // Same-tab deduplication |
| 16 | if (localPromise) { |
| 17 | return localPromise; |
| 18 | } |
| 19 | |
| 20 | localPromise = doRefresh().finally(() => { |
| 21 | localPromise = null; |
| 22 | }); |
| 23 | |
| 24 | return localPromise; |
| 25 | } |
| 26 | |
| 27 | async function doRefresh(): Promise<void> { |
| 28 | if (await tryAcquireAndRefresh()) { |
no test coverage detected