From a00597440fdbed2742a39212e1f34311343f7331 Mon Sep 17 00:00:00 2001 From: Namit2003 Date: Wed, 17 Dec 2025 19:08:44 -0500 Subject: [PATCH] feat: Add `maxItems` validation to `jobIds` array and improve API response error handling. --- src/pages/deleteJob.tsx | 2 +- src/pages/history.tsx | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/pages/deleteJob.tsx b/src/pages/deleteJob.tsx index 0109d62..59200f9 100644 --- a/src/pages/deleteJob.tsx +++ b/src/pages/deleteJob.tsx @@ -109,7 +109,7 @@ export const deleteJob = new Elysia() { auth: true, body: t.Object({ - jobIds: t.Array(t.String()), + jobIds: t.Array(t.String(), { maxItems: 100 }), }), }, ); diff --git a/src/pages/history.tsx b/src/pages/history.tsx index d599fd0..4dc404a 100644 --- a/src/pages/history.tsx +++ b/src/pages/history.tsx @@ -300,6 +300,10 @@ export const history = new Elysia().use(userService).get( body: JSON.stringify({ jobIds }), }); + if (!response.ok) { + throw new Error(\`HTTP error! status: \${response.status}\`); + } + const result = await response.json(); if (result.success || result.deleted > 0) {