restrict employee search to first and last name fields only

This commit is contained in:
Pramod Mahajan 2025-05-08 12:00:58 +05:30 committed by Vikas Nale
parent 9a885c2b72
commit 9ac15d3cf7

View File

@ -49,11 +49,10 @@ const EmployeeList = () => {
if (!employeeList.length) return; if (!employeeList.length) return;
const results = employeeList.filter((item) => const results = employeeList.filter((item) => {
Object.values(item).some( const fullName = `${item.firstName} ${item.lastName}`.toLowerCase();
(field) => field && field.toString().toLowerCase().includes(value) return fullName.includes(value);
) });
);
setFilteredData(results); setFilteredData(results);
}; };