I need to put an if condition in the service_ids if it is empty or null. If it is empty or null, i should not pass the service_ids variable. How can i do it?
const formData = {
car: form.value.car,
remarks: form.value.remarks,
if(form.value.service_ids !== null || form.value.service_ids !== []) {
service_ids: form.value.service_ids.map((a: Service) => a.service_id ? a.service_id : []),
}
}