/* global defineEventHandler, createError */ import { ResultSetHeader } from "mysql2"; import { database } from "~/server/utils/database"; export default defineEventHandler(async (e) => { const id = e.context.params?.id as string; const [result] = await database.query( "DELETE FROM `clients` WHERE `id` = ?", [id], ) as unknown as [ResultSetHeader]; if (result.affectedRows === 0) throw createError({ statusCode: 404 }); return null; });