Next.js Discord

Discord Forum

what am i doing wrong

Unanswered
astro posted this in #help-forum
Open in Discord
what am i doing wrong? the secure column should be true
try {
  await db.insert(smtpServers).values({
    ...data,
    secure: data.port === 465 ? true : false,
    userId: session.user.id,
  });
  revalidatePath("/dashboard/servers");
  return { success: "SMTP server created successfully" };
} catch (error) {
  return {
    error: "Internal server error",
  };
}

6 Replies

Catla
What happens when you console log out data.port?
@Catla What happens when you console log out data.port?
fixed this issue
it was a type error
data.port was a string
it shud've been number
Catla
Great. 🙂