@@ -8,7 +8,7 @@ import { firebaseAuth } from 'src/lib/firebase'
88export const AuthProvider = ( { children } : { children : React . ReactNode } ) => {
99 const navigate = useNavigate ( )
1010 const [ searchParams ] = useSearchParams ( )
11- const { closeAuthModal, initState, setAuthError } = useAuth ( )
11+ const { closeAuthModal, initState, setAuthError, openAuthModal } = useAuth ( )
1212
1313 const connectTheUser = useCallback ( ( token ?: string | null , provider ?: string | null ) => {
1414 const allowedProviders = [ 'google' , 'github' ]
@@ -78,16 +78,16 @@ export const AuthProvider = ({ children }: { children: React.ReactNode }) => {
7878 const token = searchParams . get ( 'access_token' )
7979 const provider = searchParams . get ( 'provider' )
8080 connectTheUser ( token , provider ) . catch ( ( error ) => {
81+ openAuthModal ( )
8182 if ( error && error . code === 'auth/account-exists-with-different-credential' ) {
82- toast (
83- 'You have an account with a different provider. Please sign in with that provider to continue.' ,
84- {
85- theme : 'dangerToast' ,
86- }
87- )
83+ setAuthError ( {
84+ message :
85+ 'You have an account with a different provider. Please sign in with that provider to continue.' ,
86+ } )
8887 } else {
89- console . log ( error )
90- toast ( 'Error signing in, Please try again' , { theme : 'dangerToast' } )
88+ setAuthError ( {
89+ message : 'Error signing in, Please try again' ,
90+ } )
9191 }
9292 } )
9393 } , [ searchParams ] )
0 commit comments