@@ -13,6 +13,7 @@ import { getCookie } from "../../stores/SyncStoreToCookies";
1313import { ThirdwebMiniLogo } from "../components/ThirdwebMiniLogo" ;
1414import { getSDKTheme } from "../components/sdk-component-theme" ;
1515import { doLogin , doLogout , getLoginPayload , isLoggedIn } from "./auth-actions" ;
16+ import { getProfiles } from "thirdweb/wallets" ;
1617
1718export default function LoginPage ( ) {
1819 return (
@@ -56,23 +57,26 @@ function CustomConnectEmmbed() {
5657 } ) ;
5758
5859 if ( ! existingAccountPreferences ) {
59- console . log ( "hello" ) ;
60- console . log ( account ) ;
60+ const profiles = await getProfiles ( { client } ) ;
61+
62+ const email = profiles . find ( ( profile ) => profile . details . email ) ?. details
63+ . email ;
6164 router . replace (
62- `/onboarding?${ account . data . email ? `email=${ account . data . email } ` : "" } ${ nextSearchParam && isValidRedirectPath ( nextSearchParam ) ? `${ account . data . email ? "&" : "" } next=${ nextSearchParam } ` : "" } ` ,
65+ `/onboarding?${ email ? `email=${ email } ` : "" } ${ nextSearchParam && isValidRedirectPath ( nextSearchParam ) ? `${ account . data . email ? "&" : "" } next=${ nextSearchParam } ` : "" } ` ,
6366 ) ;
64- } else {
65- if ( nextSearchParam && isValidRedirectPath ( nextSearchParam ) ) {
66- router . replace ( nextSearchParam ) ;
67- } else {
68- const dashboardType = getCookie ( "x-dashboard-type" ) ;
67+ return ;
68+ }
6969
70- if ( dashboardType === "team" ) {
71- router . replace ( "/team" ) ;
72- } else {
73- router . replace ( "/dashboard" ) ;
74- }
75- }
70+ if ( nextSearchParam && isValidRedirectPath ( nextSearchParam ) ) {
71+ router . replace ( nextSearchParam ) ;
72+ return ;
73+ }
74+
75+ const dashboardType = getCookie ( "x-dashboard-type" ) ;
76+ if ( dashboardType === "team" ) {
77+ router . replace ( "/team" ) ;
78+ } else {
79+ router . replace ( "/dashboard" ) ;
7680 }
7781 }
7882
0 commit comments