Skip to content

Instantly share code, notes, and snippets.

@MonteLogic
Created September 1, 2024 23:12
Show Gist options
  • Save MonteLogic/03515da82060e578597a38872545dc55 to your computer and use it in GitHub Desktop.
Save MonteLogic/03515da82060e578597a38872545dc55 to your computer and use it in GitHub Desktop.
'use server';
import { auth } from '@clerk/nextjs/server';
export default async function Page() {
const { userId, sessionClaims } = auth();
// Cast sessionClaims to the correct type
const typedSessionClaimsEmail = sessionClaims.userEmail as string | null;
console.log(5, typedSessionClaimsEmail);
// Use optional chaining and nullish coalescing for type safety
return (
<div className="relative z-0 space-y-10 text-white">
<div className="space-y-5">
<h2>Onboarding</h2>
Your email: {typedSessionClaimsEmail}
</div>
</div>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment