feat: add unified login ux/ui
This commit is contained in:
@ -9,7 +9,6 @@ interface ConnectWalletInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const ConnectWallet = ({ openModal, closeModal }: ConnectWalletInterface) => {
|
const ConnectWallet = ({ openModal, closeModal }: ConnectWalletInterface) => {
|
||||||
// Destructure the new clean methods from your unified hook
|
|
||||||
const { isConnected, walletType, userInfo, traditionalWallets, connectGoogle, connectFacebook, connectGithub, disconnect } =
|
const { isConnected, walletType, userInfo, traditionalWallets, connectGoogle, connectFacebook, connectGithub, disconnect } =
|
||||||
useUnifiedWallet()
|
useUnifiedWallet()
|
||||||
|
|
||||||
@ -19,12 +18,10 @@ const ConnectWallet = ({ openModal, closeModal }: ConnectWalletInterface) => {
|
|||||||
const handleSocialLogin = async (provider: SocialLoginProvider, connectFn: () => Promise<void>) => {
|
const handleSocialLogin = async (provider: SocialLoginProvider, connectFn: () => Promise<void>) => {
|
||||||
try {
|
try {
|
||||||
setConnectingProvider(provider)
|
setConnectingProvider(provider)
|
||||||
await connectFn() // Bypasses the Web3Auth modal
|
await connectFn()
|
||||||
closeModal()
|
closeModal()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(`${provider} login failed`, error)
|
throw new Error(`Failed to connect with ${provider}: ${error}`)
|
||||||
} finally {
|
|
||||||
setConnectingProvider(null)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user