diff --git a/dashboard/final-example/app/lib/actions.ts b/dashboard/final-example/app/lib/actions.ts index b047a645..2538da0a 100644 --- a/dashboard/final-example/app/lib/actions.ts +++ b/dashboard/final-example/app/lib/actions.ts @@ -110,8 +110,13 @@ export async function updateInvoice( } export async function deleteInvoice(id: string) { - await sql`DELETE FROM invoices WHERE id = ${id}`; - revalidatePath('/dashboard/invoices'); + try { + await sql`DELETE FROM invoices WHERE id = ${id}`; + revalidatePath('/dashboard/invoices'); + return { message: 'Deleted Invoice.' }; + } catch (error) { + return { message: 'Database Error: Failed to Delete Invoice.' }; + } } export async function authenticate(