@forge-connect/react 1.0.6 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +8 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -19,8 +19,16 @@ var ForgeConnectApiError = class extends Error {
|
|
|
19
19
|
function createApiClient(apiUrl) {
|
|
20
20
|
const base = apiUrl.replace(/\/+$/, "");
|
|
21
21
|
const inflightRequests = /* @__PURE__ */ new Map();
|
|
22
|
+
let inflightRefresh = null;
|
|
22
23
|
async function request(path, options = {}) {
|
|
23
24
|
const { method = "GET", body, token } = options;
|
|
25
|
+
if (method === "POST" && path === "/auth/refresh") {
|
|
26
|
+
if (inflightRefresh) return inflightRefresh;
|
|
27
|
+
inflightRefresh = doRequest(path, options).finally(() => {
|
|
28
|
+
inflightRefresh = null;
|
|
29
|
+
});
|
|
30
|
+
return inflightRefresh;
|
|
31
|
+
}
|
|
24
32
|
if (method === "GET" && token) {
|
|
25
33
|
const dedupKey = `${path}:${token}`;
|
|
26
34
|
const inflight = inflightRequests.get(dedupKey);
|