ghostguild-org/server/api/auth/member.get.js
Jennie Robinson Faber 0ca38e5588 fix(auth): expose helcimCustomerId on /api/auth/member
The member account page gates the Helcim customer portal link on
`memberData.helcimCustomerId`, but this endpoint (the source for
`useAuth().memberData`) omitted the field, so the link hid for every
member regardless of Helcim enrollment. Add the field to the response.
2026-04-19 13:04:46 +01:00

33 lines
991 B
JavaScript

import { requireAuth } from "../../utils/auth.js";
export default defineEventHandler(async (event) => {
const member = await requireAuth(event);
return {
_id: member._id,
id: member._id,
email: member.email,
name: member.name,
status: member.status,
role: member.role || 'member',
circle: member.circle,
contributionTier: member.contributionTier,
billingCadence: member.billingCadence,
helcimCustomerId: member.helcimCustomerId,
membershipLevel: `${member.circle}-${member.contributionTier}`,
// Profile fields
pronouns: member.pronouns,
timeZone: member.timeZone,
avatar: member.avatar,
studio: member.studio,
bio: member.bio,
location: member.location,
socialLinks: member.socialLinks,
craftTags: member.craftTags,
board: member.board,
showInDirectory: member.showInDirectory,
notifications: member.notifications,
createdAt: member.createdAt,
onboarding: member.onboarding,
};
});