Skip to content

Instantly share code, notes, and snippets.

@popeating
Created November 3, 2023 13:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save popeating/5674e3d1d8f85649c8ab37edf9e527ad to your computer and use it in GitHub Desktop.
Save popeating/5674e3d1d8f85649c8ab37edf9e527ad to your computer and use it in GitHub Desktop.
export async function contactAdd(data) {
try {
const contact = new Contact(data);
contact.save();
const newContact = { ...contact._doc, _id: contact._doc._id.toString() };
revalidatePath('/');
return newContact;
} catch (e) {
return { error: e.message };
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment