@@ -54,8 +54,8 @@ function makeClientFromData(data) {
5454
5555 // составляем объект, где есть только необходимые поля
5656 const client = {
57- name : asString ( data . name ) ,
5857 surname : asString ( data . surname ) ,
58+ name : asString ( data . name ) ,
5959 patronymic : asString ( data . patronymic ) ,
6060 contacts : Array . isArray ( data . contacts )
6161 ? data . contacts . map ( ( contact ) => ( {
@@ -66,9 +66,9 @@ function makeClientFromData(data) {
6666 } ;
6767
6868 // проверяем, все ли данные корректные и заполняем объект ошибок, которые нужно отдать клиенту
69- if ( ! client . name ) errors . push ( { field : "name" , message : "Не указано имя!" } ) ;
7069 if ( ! client . surname )
7170 errors . push ( { field : "surname" , message : "Не указана фамилия!" } ) ;
71+ if ( ! client . name ) errors . push ( { field : "name" , message : "Не указано имя!" } ) ;
7272 if ( client . contacts . some ( ( contact ) => ! contact . type || ! contact . value ) )
7373 errors . push ( {
7474 field : "contacts" ,
@@ -92,8 +92,8 @@ function getClientList(params = {}) {
9292 const search = params . search . trim ( ) . toLowerCase ( ) ;
9393 return clients . filter ( ( client ) =>
9494 [
95- client . name ,
9695 client . surname ,
96+ client . name ,
9797 client . patronymic ,
9898 ...client . contacts . map ( ( { value } ) => value ) ,
9999 ] . some ( ( str ) => str . toLowerCase ( ) . includes ( search ) )
0 commit comments