export async function AppHeaderUserMenu() {
cacheLife({ stale: 3600 }); // Cache for 1 hour (3600 seconds)
const authService = createAuthService();
const profileService = createProfileService();
// Get user ID from JWT claims (fast, local check)
const userIdResult = await authService.getCurrentUser();
if (isErr(userIdResult)) {
redirect("/login");
}
const userId = userIdResult.data;
// Fetch profile from database
const profileResult = await profileService.getProfileById(userId);
if (isErr(profileResult)) {
redirect("/login");
}
const profile = profileResult.data;
return <AppHeaderUserMenuDropdown profile={profile} />;
}
export async function AppHeaderUserMenu() {
cacheLife({ stale: 3600 }); // Cache for 1 hour (3600 seconds)
const authService = createAuthService();
const profileService = createProfileService();
// Get user ID from JWT claims (fast, local check)
const userIdResult = await authService.getCurrentUser();
if (isErr(userIdResult)) {
redirect("/login");
}
const userId = userIdResult.data;
// Fetch profile from database
const profileResult = await profileService.getProfileById(userId);
if (isErr(profileResult)) {
redirect("/login");
}
const profile = profileResult.data;
return <AppHeaderUserMenuDropdown profile={profile} />;
}