@djangocfg/api 2.1.484 → 2.1.487
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/auth.cjs +13 -7
- package/dist/auth.cjs.map +1 -1
- package/dist/auth.mjs +13 -7
- package/dist/auth.mjs.map +1 -1
- package/dist/clients.cjs +13 -4
- package/dist/clients.cjs.map +1 -1
- package/dist/clients.mjs +13 -4
- package/dist/clients.mjs.map +1 -1
- package/dist/hooks.cjs +13 -4
- package/dist/hooks.cjs.map +1 -1
- package/dist/hooks.mjs +13 -4
- package/dist/hooks.mjs.map +1 -1
- package/dist/index.cjs +13 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.mjs +13 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/_api/generated/helpers/auth.ts +34 -8
- package/src/auth/context/AccountsContext.tsx +5 -1
- package/src/auth/hooks/useGithubAuth.ts +3 -2
- package/src/auth/hooks/useTwoFactorVerify.ts +2 -1
package/dist/clients.mjs
CHANGED
|
@@ -135,8 +135,12 @@ var cookieBackend = {
|
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
137
|
};
|
|
138
|
-
|
|
138
|
+
function backendFor(mode) {
|
|
139
|
+
return mode === "cookie" ? cookieBackend : mode === "sessionStorage" ? sessionStorageBackend : localStorageBackend;
|
|
140
|
+
}
|
|
141
|
+
__name(backendFor, "backendFor");
|
|
139
142
|
var _storageMode = "localStorage";
|
|
143
|
+
var _storage = backendFor(_storageMode);
|
|
140
144
|
function detectLocale() {
|
|
141
145
|
try {
|
|
142
146
|
if (typeof document !== "undefined") {
|
|
@@ -290,9 +294,12 @@ var auth = {
|
|
|
290
294
|
getStorageMode() {
|
|
291
295
|
return _storageMode;
|
|
292
296
|
},
|
|
297
|
+
/** Relocate the session backend. Call once at bootstrap, before any sign-in:
|
|
298
|
+
* the mode is module state and resets on reload, so a later switch strands
|
|
299
|
+
* whatever was written after it. */
|
|
293
300
|
setStorageMode(mode) {
|
|
294
301
|
_storageMode = mode;
|
|
295
|
-
_storage = mode
|
|
302
|
+
_storage = backendFor(mode);
|
|
296
303
|
notifySessionChanged();
|
|
297
304
|
},
|
|
298
305
|
// ── Bearer token ──────────────────────────────────────────────────
|
|
@@ -311,8 +318,10 @@ var auth = {
|
|
|
311
318
|
notifySessionChanged();
|
|
312
319
|
},
|
|
313
320
|
clearTokens() {
|
|
314
|
-
|
|
315
|
-
|
|
321
|
+
for (const backend of [localStorageBackend, sessionStorageBackend, cookieBackend]) {
|
|
322
|
+
backend.set(ACCESS_KEY, null);
|
|
323
|
+
backend.set(REFRESH_KEY, null);
|
|
324
|
+
}
|
|
316
325
|
notifySessionChanged();
|
|
317
326
|
},
|
|
318
327
|
/** Session-aware: token PRESENT and not past its `exp` (or a live refresh
|