|
| 1 | +'use client'; |
| 2 | + |
1 | 3 | import { useAccount as useWagmiAccount, useConnect, useDisconnect, useSignMessage, useSwitchAccount, useConnections } from 'wagmi'; |
2 | 4 | import { useAccount as useParaAccount, useLogout, useWallet as useParaWallet } from '@getpara/react-sdk'; |
3 | 5 | import { useSkipped } from '@/context/SkippedContext'; |
4 | 6 | import { usePathname } from 'next/navigation'; |
5 | 7 | import React, { useEffect, useMemo, useState, useRef } from 'react'; |
6 | 8 | import { appKit } from '@/config/appkit'; |
| 9 | +import { useUser } from '@/hooks/useUser'; |
7 | 10 |
|
8 | 11 | // Simple state - no complex global management needed |
9 | 12 |
|
@@ -179,6 +182,9 @@ export function useUnifiedConnection() { |
179 | 182 | const paraWallet = useParaWallet(); |
180 | 183 | const { logout } = useLogout(); |
181 | 184 |
|
| 185 | + // Supabase auth hook - for email from Supabase authentication |
| 186 | + const { user: supabaseUser } = useUser(); |
| 187 | + |
182 | 188 | // Skipped state from shared context |
183 | 189 | const { isSkipped, setSkipped, clearSkipped } = useSkipped(); |
184 | 190 | const pathname = usePathname(); |
@@ -776,6 +782,9 @@ export function useUnifiedConnection() { |
776 | 782 |
|
777 | 783 | if (allSuccessful) { |
778 | 784 | console.log('🔌 [UNIFIED_DISCONNECT] All disconnect operations completed successfully'); |
| 785 | + if (typeof window !== 'undefined') { |
| 786 | + window.location.href = '/onboarding'; |
| 787 | + } |
779 | 788 | } else { |
780 | 789 | console.warn('🔌 [UNIFIED_DISCONNECT] Some disconnect operations failed:', disconnectResults); |
781 | 790 | // Don't throw error if at least wagmi disconnect succeeded (most important) |
@@ -898,6 +907,10 @@ Issued At: ${issuedAt}`; |
898 | 907 | isParaConnected, |
899 | 908 | paraEmail: paraAccount?.embedded?.email || null, |
900 | 909 |
|
| 910 | + // Supabase auth state |
| 911 | + supabaseEmail: supabaseUser?.email || null, |
| 912 | + email: supabaseUser?.email || paraAccount?.embedded?.email || null, |
| 913 | + |
901 | 914 | // Connectors |
902 | 915 | connectors, |
903 | 916 | switchableConnectors, |
|
0 commit comments