mirror of
https://github.com/acedanger/finance.git
synced 2025-12-05 22:50:12 -08:00
#1 Enhance transaction management UI with form validation, loading states, and improved error handling
This commit is contained in:
@@ -6,10 +6,13 @@ export const PUT: APIRoute = async ({ request, params }) => {
|
||||
const { id } = params;
|
||||
|
||||
if (!id) {
|
||||
return new Response(JSON.stringify({ error: "Transaction ID is required" }), {
|
||||
status: 400,
|
||||
headers: { "Content-Type": "application/json" },
|
||||
});
|
||||
return new Response(
|
||||
JSON.stringify({ error: "Transaction ID is required" }),
|
||||
{
|
||||
status: 400,
|
||||
headers: { "Content-Type": "application/json" },
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -65,10 +68,13 @@ export const DELETE: APIRoute = async ({ params }) => {
|
||||
const { id } = params;
|
||||
|
||||
if (!id) {
|
||||
return new Response(JSON.stringify({ error: "Transaction ID is required" }), {
|
||||
status: 400,
|
||||
headers: { "Content-Type": "application/json" },
|
||||
});
|
||||
return new Response(
|
||||
JSON.stringify({ error: "Transaction ID is required" }),
|
||||
{
|
||||
status: 400,
|
||||
headers: { "Content-Type": "application/json" },
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
const transactionIndex = transactions.findIndex((t) => t.id === id);
|
||||
|
||||
Reference in New Issue
Block a user