@djangocfg/api 2.1.149 → 2.1.151
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 +9 -32
- package/dist/auth.cjs.map +1 -1
- package/dist/auth.d.cts +1 -12
- package/dist/auth.d.ts +1 -12
- package/dist/auth.mjs +9 -32
- package/dist/auth.mjs.map +1 -1
- package/package.json +2 -2
- package/src/auth/context/AuthContext.tsx +12 -40
- package/src/auth/context/types.ts +1 -8
package/dist/auth.d.cts
CHANGED
|
@@ -245,15 +245,6 @@ interface AuthConfig {
|
|
|
245
245
|
defaultAuthCallback?: string;
|
|
246
246
|
};
|
|
247
247
|
onLogout?: () => void;
|
|
248
|
-
onConfirm?: (options: {
|
|
249
|
-
title: string;
|
|
250
|
-
description: string;
|
|
251
|
-
confirmationButtonText: string;
|
|
252
|
-
cancellationButtonText: string;
|
|
253
|
-
color: string;
|
|
254
|
-
}) => Promise<{
|
|
255
|
-
confirmed: boolean;
|
|
256
|
-
}>;
|
|
257
248
|
}
|
|
258
249
|
interface AuthContextType {
|
|
259
250
|
user: UserProfile | null;
|
|
@@ -286,9 +277,7 @@ interface AuthContextType {
|
|
|
286
277
|
success: boolean;
|
|
287
278
|
message: string;
|
|
288
279
|
}>;
|
|
289
|
-
logout: (
|
|
290
|
-
skipConfirm?: boolean;
|
|
291
|
-
}) => Promise<void>;
|
|
280
|
+
logout: () => void;
|
|
292
281
|
saveRedirectUrl: (url: string) => void;
|
|
293
282
|
getRedirectUrl: () => string;
|
|
294
283
|
clearRedirectUrl: () => void;
|
package/dist/auth.d.ts
CHANGED
|
@@ -245,15 +245,6 @@ interface AuthConfig {
|
|
|
245
245
|
defaultAuthCallback?: string;
|
|
246
246
|
};
|
|
247
247
|
onLogout?: () => void;
|
|
248
|
-
onConfirm?: (options: {
|
|
249
|
-
title: string;
|
|
250
|
-
description: string;
|
|
251
|
-
confirmationButtonText: string;
|
|
252
|
-
cancellationButtonText: string;
|
|
253
|
-
color: string;
|
|
254
|
-
}) => Promise<{
|
|
255
|
-
confirmed: boolean;
|
|
256
|
-
}>;
|
|
257
248
|
}
|
|
258
249
|
interface AuthContextType {
|
|
259
250
|
user: UserProfile | null;
|
|
@@ -286,9 +277,7 @@ interface AuthContextType {
|
|
|
286
277
|
success: boolean;
|
|
287
278
|
message: string;
|
|
288
279
|
}>;
|
|
289
|
-
logout: (
|
|
290
|
-
skipConfirm?: boolean;
|
|
291
|
-
}) => Promise<void>;
|
|
280
|
+
logout: () => void;
|
|
292
281
|
saveRedirectUrl: (url: string) => void;
|
|
293
282
|
getRedirectUrl: () => string;
|
|
294
283
|
clearRedirectUrl: () => void;
|
package/dist/auth.mjs
CHANGED
|
@@ -6050,38 +6050,15 @@ var AuthProviderInternal = /* @__PURE__ */ __name(({ children, config }) => {
|
|
|
6050
6050
|
};
|
|
6051
6051
|
}
|
|
6052
6052
|
}, [clearAuthState, accounts]);
|
|
6053
|
-
const logout = useCallback12(
|
|
6054
|
-
|
|
6055
|
-
|
|
6056
|
-
|
|
6057
|
-
|
|
6058
|
-
|
|
6059
|
-
|
|
6060
|
-
|
|
6061
|
-
|
|
6062
|
-
router.hardReplace(authCallbackUrl);
|
|
6063
|
-
}, "performLogout");
|
|
6064
|
-
if (options?.skipConfirm) {
|
|
6065
|
-
performLogout();
|
|
6066
|
-
return;
|
|
6067
|
-
}
|
|
6068
|
-
if (configRef.current?.onConfirm) {
|
|
6069
|
-
const { confirmed } = await configRef.current.onConfirm({
|
|
6070
|
-
title: "Logout",
|
|
6071
|
-
description: "Are you sure you want to logout?",
|
|
6072
|
-
confirmationButtonText: "Logout",
|
|
6073
|
-
cancellationButtonText: "Cancel",
|
|
6074
|
-
color: "error"
|
|
6075
|
-
});
|
|
6076
|
-
if (confirmed) {
|
|
6077
|
-
performLogout();
|
|
6078
|
-
}
|
|
6079
|
-
} else {
|
|
6080
|
-
const confirmed = window.confirm("Are you sure you want to logout?");
|
|
6081
|
-
if (confirmed) {
|
|
6082
|
-
performLogout();
|
|
6083
|
-
}
|
|
6084
|
-
}
|
|
6053
|
+
const logout = useCallback12(() => {
|
|
6054
|
+
Analytics.event("auth_logout" /* AUTH_LOGOUT */, {
|
|
6055
|
+
category: "auth" /* AUTH */
|
|
6056
|
+
});
|
|
6057
|
+
accounts.logout();
|
|
6058
|
+
setInitialized(true);
|
|
6059
|
+
setIsLoading(false);
|
|
6060
|
+
const authCallbackUrl = config?.routes?.defaultAuthCallback || defaultRoutes.defaultAuthCallback;
|
|
6061
|
+
router.hardReplace(authCallbackUrl);
|
|
6085
6062
|
}, [accounts, config?.routes?.defaultAuthCallback, router]);
|
|
6086
6063
|
const isAdminUser = useMemo2(() => {
|
|
6087
6064
|
return Boolean(user?.is_staff || user?.is_superuser);
|