19 lines
532 B
TypeScript
19 lines
532 B
TypeScript
"use server";
|
|
|
|
import {callApi} from "@/lib/api/callApi";
|
|
import {customerRoutes} from "@/app/api/customers/customerRoutes";
|
|
import {Customer} from "@/services/customers/entities/customer";
|
|
|
|
export async function validateCustomer(input: {
|
|
email: string;
|
|
companyName: string;
|
|
street: string;
|
|
zip: string;
|
|
city: string;
|
|
}): Promise<Customer[]> {
|
|
if (Object.values(input).every(value => !value?.trim())) {
|
|
return [];
|
|
}
|
|
|
|
return await callApi<Customer[]>(customerRoutes.validate, "POST", input);
|
|
} |