@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/hooks.mjs
CHANGED
|
@@ -932,8 +932,12 @@ var cookieBackend = {
|
|
|
932
932
|
}
|
|
933
933
|
}
|
|
934
934
|
};
|
|
935
|
-
|
|
935
|
+
function backendFor(mode) {
|
|
936
|
+
return mode === "cookie" ? cookieBackend : mode === "sessionStorage" ? sessionStorageBackend : localStorageBackend;
|
|
937
|
+
}
|
|
938
|
+
__name(backendFor, "backendFor");
|
|
936
939
|
var _storageMode = "localStorage";
|
|
940
|
+
var _storage = backendFor(_storageMode);
|
|
937
941
|
function detectLocale() {
|
|
938
942
|
try {
|
|
939
943
|
if (typeof document !== "undefined") {
|
|
@@ -1087,9 +1091,12 @@ var auth = {
|
|
|
1087
1091
|
getStorageMode() {
|
|
1088
1092
|
return _storageMode;
|
|
1089
1093
|
},
|
|
1094
|
+
/** Relocate the session backend. Call once at bootstrap, before any sign-in:
|
|
1095
|
+
* the mode is module state and resets on reload, so a later switch strands
|
|
1096
|
+
* whatever was written after it. */
|
|
1090
1097
|
setStorageMode(mode) {
|
|
1091
1098
|
_storageMode = mode;
|
|
1092
|
-
_storage = mode
|
|
1099
|
+
_storage = backendFor(mode);
|
|
1093
1100
|
notifySessionChanged();
|
|
1094
1101
|
},
|
|
1095
1102
|
// ── Bearer token ──────────────────────────────────────────────────
|
|
@@ -1108,8 +1115,10 @@ var auth = {
|
|
|
1108
1115
|
notifySessionChanged();
|
|
1109
1116
|
},
|
|
1110
1117
|
clearTokens() {
|
|
1111
|
-
|
|
1112
|
-
|
|
1118
|
+
for (const backend of [localStorageBackend, sessionStorageBackend, cookieBackend]) {
|
|
1119
|
+
backend.set(ACCESS_KEY, null);
|
|
1120
|
+
backend.set(REFRESH_KEY, null);
|
|
1121
|
+
}
|
|
1113
1122
|
notifySessionChanged();
|
|
1114
1123
|
},
|
|
1115
1124
|
/** Session-aware: token PRESENT and not past its `exp` (or a live refresh
|