@djangocfg/api 2.1.101 → 2.1.102

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@djangocfg/api",
3
- "version": "2.1.101",
3
+ "version": "2.1.102",
4
4
  "description": "Auto-generated TypeScript API client with React hooks, SWR integration, and Zod validation for Django REST Framework backends",
5
5
  "keywords": [
6
6
  "django",
@@ -74,7 +74,7 @@
74
74
  "check": "tsc --noEmit"
75
75
  },
76
76
  "peerDependencies": {
77
- "@djangocfg/ui-nextjs": "^2.1.101",
77
+ "@djangocfg/ui-nextjs": "^2.1.102",
78
78
  "consola": "^3.4.2",
79
79
  "next": ">=16.0.0",
80
80
  "p-retry": "^7.0.0",
@@ -85,7 +85,7 @@
85
85
  "devDependencies": {
86
86
  "@types/node": "^24.7.2",
87
87
  "@types/react": "^19.0.0",
88
- "@djangocfg/typescript-config": "^2.1.101",
88
+ "@djangocfg/typescript-config": "^2.1.102",
89
89
  "next": "^16.0.0",
90
90
  "react": "^19.0.0",
91
91
  "tsup": "^8.5.0",
@@ -510,7 +510,7 @@ const AuthProviderInternal: React.FC<AuthProviderProps> = ({ children, config })
510
510
  }
511
511
  }, [clearAuthState, accounts]);
512
512
 
513
- const logout = useCallback(async (): Promise<void> => {
513
+ const logout = useCallback(async (options?: { skipConfirm?: boolean }): Promise<void> => {
514
514
  const performLogout = () => {
515
515
  // Track logout
516
516
  Analytics.event(AnalyticsEvent.AUTH_LOGOUT, {
@@ -527,6 +527,12 @@ const AuthProviderInternal: React.FC<AuthProviderProps> = ({ children, config })
527
527
  router.hardReplace(authCallbackUrl);
528
528
  };
529
529
 
530
+ // Skip confirmation if requested (e.g., after account deletion)
531
+ if (options?.skipConfirm) {
532
+ performLogout();
533
+ return;
534
+ }
535
+
530
536
  // Use config.onConfirm if provided, otherwise use a simple confirm
531
537
  if (configRef.current?.onConfirm) {
532
538
  const { confirmed } = await configRef.current.onConfirm({
@@ -677,7 +683,7 @@ const defaultAuthState: AuthContextType = {
677
683
  authLogger.warn('useAuth: refreshToken called outside AuthProvider');
678
684
  return { success: false, message: 'AuthProvider not available' };
679
685
  },
680
- logout: async () => {
686
+ logout: async (_options?: { skipConfirm?: boolean }) => {
681
687
  authLogger.warn('useAuth: logout called outside AuthProvider');
682
688
  },
683
689
  saveRedirectUrl: () => {},
@@ -57,7 +57,7 @@ export interface AuthContextType {
57
57
  should_prompt_2fa?: boolean;
58
58
  }>;
59
59
  refreshToken: () => Promise<{ success: boolean; message: string }>;
60
- logout: () => Promise<void>;
60
+ logout: (options?: { skipConfirm?: boolean }) => Promise<void>;
61
61
 
62
62
  // Redirect URL Methods - for saving URL before auth redirect
63
63
  saveRedirectUrl: (url: string) => void;