"use server"; import {CreateCustomerDto} from "@/services/customers/dtos/createCustomer.dto"; import {customerRoutes} from "@/app/api/customers/customerRoutes"; import {callApi} from "@/lib/api/callApi"; import {UUID} from "node:crypto"; export async function addCustomer(params: CreateCustomerDto): Promise { const {email, name, companyName, street, zip, city, phoneNumbers, notes} = params; const payload: CreateCustomerDto = { email, name, companyName, street, zip, city, phoneNumbers, notes: notes.map(({text}) => ({text})), }; const response = await callApi(customerRoutes.create, "POST", payload); console.log(response); }