From 4ae62f291155b5d22ad1169c80e24d1f0da6b5ae Mon Sep 17 00:00:00 2001 From: Thatsaphorn Atchariyaphap Date: Mon, 7 Jul 2025 22:02:38 +0200 Subject: [PATCH] Handle empty input validation in `validateCustomer` use case --- .../services/customers/usecases/validateCustomer.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal_frontend/services/customers/usecases/validateCustomer.ts b/internal_frontend/services/customers/usecases/validateCustomer.ts index 5de1984..abcd497 100644 --- a/internal_frontend/services/customers/usecases/validateCustomer.ts +++ b/internal_frontend/services/customers/usecases/validateCustomer.ts @@ -11,5 +11,9 @@ export async function validateCustomer(input: { zip: string; city: string; }): Promise { + if (Object.values(input).every(value => !value?.trim())) { + return []; + } + return await callApi(customerRoutes.validate, "POST", input); } \ No newline at end of file