Created
November 3, 2023 13:10
-
-
Save popeating/5e3baa80268d227db2967f143e8d8725 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export async function contactDelete(id) { | |
try { | |
const contact = await Contact.findByIdAndDelete(id, { new: true }); | |
revalidatePath('/'); | |
const newContact = { ...contact._doc, _id: contact._doc._id.toString() }; | |
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