diff --git a/src/app/api/auth/[...nextauth]/route.ts b/src/app/api/auth/[...nextauth]/route.ts index bcf1204..786f664 100644 --- a/src/app/api/auth/[...nextauth]/route.ts +++ b/src/app/api/auth/[...nextauth]/route.ts @@ -105,7 +105,6 @@ export const AuthOptions: NextAuthOptions = { async signIn({ user, account }) { try { if (!user?.email) return false; - const normalisedEmail = user.email.toLowerCase(); // Fetch the user (NextAuth will have created them already if new) @@ -121,6 +120,7 @@ export const AuthOptions: NextAuthOptions = { // Link OAuth ID if missing (helps for older accounts) if (account && !dbUser.oauthId) { + console.log("Linking OAuth ID for user:", normalisedEmail); const provider = account.provider as OauthProvider; await db .update(users) @@ -137,7 +137,6 @@ export const AuthOptions: NextAuthOptions = { // Pass bigint ID into NextAuth session/jwt user.dbId = dbUser.id.toString(); user.onboarded = dbUser.onboarded ?? false; - return true; } catch (error) { console.error("Error during sign-in:", error); @@ -166,6 +165,10 @@ export const AuthOptions: NextAuthOptions = { token.onboarded = existing.onboarded; } } + + if (userFromLogin?.dbId) { + token.dbId = userFromLogin.dbId; + } return token; }, diff --git a/src/app/home/page.tsx b/src/app/home/page.tsx index 2a172d3..5d873ab 100644 --- a/src/app/home/page.tsx +++ b/src/app/home/page.tsx @@ -4,26 +4,25 @@ import { AuthOptions } from "@/app/api/auth/[...nextauth]/route"; import { getServerSession } from "next-auth"; import { redirect } from "next/navigation"; - const Home = async () => { const user = await getServerSession(AuthOptions); - if (!user?.user) { console.error("User not found"); redirect("/"); } - const portfolios = await getPortfolios(user.user.dbId); - return ( <>
-

Your Portfolios

+

+ {" "} + Your Portfolios{" "} +

- +
); diff --git a/src/app/portfolio/[slug]/remote-assessment/page.tsx b/src/app/portfolio/[slug]/remote-assessment/page.tsx new file mode 100644 index 0000000..b82ec52 --- /dev/null +++ b/src/app/portfolio/[slug]/remote-assessment/page.tsx @@ -0,0 +1,12 @@ +export default function RemoteAssessmentPage() { + return ( +
+

Remote Assessment

+

+ Welcome to the Remote Assessment page. Here you can start your remote + assessment process. +

+ {/* Additional content and components for remote assessment can be added here */} +
+ ); +}