@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/index.cjs
CHANGED
|
@@ -207,8 +207,12 @@ var cookieBackend = {
|
|
|
207
207
|
}
|
|
208
208
|
}
|
|
209
209
|
};
|
|
210
|
-
|
|
210
|
+
function backendFor(mode) {
|
|
211
|
+
return mode === "cookie" ? cookieBackend : mode === "sessionStorage" ? sessionStorageBackend : localStorageBackend;
|
|
212
|
+
}
|
|
213
|
+
__name(backendFor, "backendFor");
|
|
211
214
|
var _storageMode = "localStorage";
|
|
215
|
+
var _storage = backendFor(_storageMode);
|
|
212
216
|
function detectLocale() {
|
|
213
217
|
try {
|
|
214
218
|
if (typeof document !== "undefined") {
|
|
@@ -362,9 +366,12 @@ var auth = {
|
|
|
362
366
|
getStorageMode() {
|
|
363
367
|
return _storageMode;
|
|
364
368
|
},
|
|
369
|
+
/** Relocate the session backend. Call once at bootstrap, before any sign-in:
|
|
370
|
+
* the mode is module state and resets on reload, so a later switch strands
|
|
371
|
+
* whatever was written after it. */
|
|
365
372
|
setStorageMode(mode) {
|
|
366
373
|
_storageMode = mode;
|
|
367
|
-
_storage = mode
|
|
374
|
+
_storage = backendFor(mode);
|
|
368
375
|
notifySessionChanged();
|
|
369
376
|
},
|
|
370
377
|
// ── Bearer token ──────────────────────────────────────────────────
|
|
@@ -383,8 +390,10 @@ var auth = {
|
|
|
383
390
|
notifySessionChanged();
|
|
384
391
|
},
|
|
385
392
|
clearTokens() {
|
|
386
|
-
|
|
387
|
-
|
|
393
|
+
for (const backend of [localStorageBackend, sessionStorageBackend, cookieBackend]) {
|
|
394
|
+
backend.set(ACCESS_KEY, null);
|
|
395
|
+
backend.set(REFRESH_KEY, null);
|
|
396
|
+
}
|
|
388
397
|
notifySessionChanged();
|
|
389
398
|
},
|
|
390
399
|
/** Session-aware: token PRESENT and not past its `exp` (or a live refresh
|