Skip to content

Commit

Permalink
fix(server): member undefined when verify payment (#66)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsun969 authored Feb 18, 2024
1 parent 15b4adf commit 4f91732
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/server/verify-membership-payment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ import { updateMemberExpiryDate } from './update-member-expiry-date';

export const verifyMembershipPayment = async (clerkId: string) => {
// Get user's membership expiry date from the database
const [{ membershipExpiresAt }] = await db
const [member] = await db
.select({
id: memberTable.id,
membershipExpiresAt: memberTable.membershipExpiresAt,
})
.from(memberTable)
.where(eq(memberTable.clerkId, clerkId));
// If membership expiry date exists, return the existing date
if (membershipExpiresAt) {
return { paid: true as const, membershipExpiresAt };
if (member && member.membershipExpiresAt) {
return { paid: true as const, membershipExpiresAt: member.membershipExpiresAt };
}

const paymentId = await redisClient.hGet(`payment:membership:${clerkId}`, 'paymentId');
Expand Down

0 comments on commit 4f91732

Please sign in to comment.