import { ObjectId } from "mongodb"; export default defineEventHandler(async (event) => { const { id } = await readBody(event) const user = await getAuth(event) const storesColl = db.collection('stores'); const result = await storesColl.deleteOne({ _id: new ObjectId(id) }) if (result.deletedCount === 1) { return result } else { throw createError({ statusCode: 500, statusMessage: 'Error tijdens het verwijderen van de store' }) } });