Skip to content

Commit e9b6ebc

Browse files
committed
fix: use profile email in onboarding
1 parent 1c4b0f7 commit e9b6ebc

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

apps/dashboard/src/app/login/page.tsx

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { getCookie } from "../../stores/SyncStoreToCookies";
1313
import { ThirdwebMiniLogo } from "../components/ThirdwebMiniLogo";
1414
import { getSDKTheme } from "../components/sdk-component-theme";
1515
import { doLogin, doLogout, getLoginPayload, isLoggedIn } from "./auth-actions";
16+
import { getProfiles } from "thirdweb/wallets";
1617

1718
export 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

Comments
 (0)