@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.cjs
CHANGED
|
@@ -966,8 +966,12 @@ var cookieBackend = {
|
|
|
966
966
|
}
|
|
967
967
|
}
|
|
968
968
|
};
|
|
969
|
-
|
|
969
|
+
function backendFor(mode) {
|
|
970
|
+
return mode === "cookie" ? cookieBackend : mode === "sessionStorage" ? sessionStorageBackend : localStorageBackend;
|
|
971
|
+
}
|
|
972
|
+
__name(backendFor, "backendFor");
|
|
970
973
|
var _storageMode = "localStorage";
|
|
974
|
+
var _storage = backendFor(_storageMode);
|
|
971
975
|
function detectLocale() {
|
|
972
976
|
try {
|
|
973
977
|
if (typeof document !== "undefined") {
|
|
@@ -1121,9 +1125,12 @@ var auth = {
|
|
|
1121
1125
|
getStorageMode() {
|
|
1122
1126
|
return _storageMode;
|
|
1123
1127
|
},
|
|
1128
|
+
/** Relocate the session backend. Call once at bootstrap, before any sign-in:
|
|
1129
|
+
* the mode is module state and resets on reload, so a later switch strands
|
|
1130
|
+
* whatever was written after it. */
|
|
1124
1131
|
setStorageMode(mode) {
|
|
1125
1132
|
_storageMode = mode;
|
|
1126
|
-
_storage = mode
|
|
1133
|
+
_storage = backendFor(mode);
|
|
1127
1134
|
notifySessionChanged();
|
|
1128
1135
|
},
|
|
1129
1136
|
// ── Bearer token ──────────────────────────────────────────────────
|
|
@@ -1142,8 +1149,10 @@ var auth = {
|
|
|
1142
1149
|
notifySessionChanged();
|
|
1143
1150
|
},
|
|
1144
1151
|
clearTokens() {
|
|
1145
|
-
|
|
1146
|
-
|
|
1152
|
+
for (const backend of [localStorageBackend, sessionStorageBackend, cookieBackend]) {
|
|
1153
|
+
backend.set(ACCESS_KEY, null);
|
|
1154
|
+
backend.set(REFRESH_KEY, null);
|
|
1155
|
+
}
|
|
1147
1156
|
notifySessionChanged();
|
|
1148
1157
|
},
|
|
1149
1158
|
/** Session-aware: token PRESENT and not past its `exp` (or a live refresh
|