Handle empty input validation in validateCustomer use case
This commit is contained in:
@@ -11,5 +11,9 @@ export async function validateCustomer(input: {
|
|||||||
zip: string;
|
zip: string;
|
||||||
city: string;
|
city: string;
|
||||||
}): Promise<Customer[]> {
|
}): Promise<Customer[]> {
|
||||||
|
if (Object.values(input).every(value => !value?.trim())) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
return await callApi<Customer[]>(customerRoutes.validate, "POST", input);
|
return await callApi<Customer[]>(customerRoutes.validate, "POST", input);
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user