@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.cjs
CHANGED
|
@@ -163,8 +163,12 @@ var cookieBackend = {
|
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
165
|
};
|
|
166
|
-
|
|
166
|
+
function backendFor(mode) {
|
|
167
|
+
return mode === "cookie" ? cookieBackend : mode === "sessionStorage" ? sessionStorageBackend : localStorageBackend;
|
|
168
|
+
}
|
|
169
|
+
__name(backendFor, "backendFor");
|
|
167
170
|
var _storageMode = "localStorage";
|
|
171
|
+
var _storage = backendFor(_storageMode);
|
|
168
172
|
function detectLocale() {
|
|
169
173
|
try {
|
|
170
174
|
if (typeof document !== "undefined") {
|
|
@@ -318,9 +322,12 @@ var auth = {
|
|
|
318
322
|
getStorageMode() {
|
|
319
323
|
return _storageMode;
|
|
320
324
|
},
|
|
325
|
+
/** Relocate the session backend. Call once at bootstrap, before any sign-in:
|
|
326
|
+
* the mode is module state and resets on reload, so a later switch strands
|
|
327
|
+
* whatever was written after it. */
|
|
321
328
|
setStorageMode(mode) {
|
|
322
329
|
_storageMode = mode;
|
|
323
|
-
_storage = mode
|
|
330
|
+
_storage = backendFor(mode);
|
|
324
331
|
notifySessionChanged();
|
|
325
332
|
},
|
|
326
333
|
// ── Bearer token ──────────────────────────────────────────────────
|
|
@@ -339,8 +346,10 @@ var auth = {
|
|
|
339
346
|
notifySessionChanged();
|
|
340
347
|
},
|
|
341
348
|
clearTokens() {
|
|
342
|
-
|
|
343
|
-
|
|
349
|
+
for (const backend of [localStorageBackend, sessionStorageBackend, cookieBackend]) {
|
|
350
|
+
backend.set(ACCESS_KEY, null);
|
|
351
|
+
backend.set(REFRESH_KEY, null);
|
|
352
|
+
}
|
|
344
353
|
notifySessionChanged();
|
|
345
354
|
},
|
|
346
355
|
/** Session-aware: token PRESENT and not past its `exp` (or a live refresh
|