Browse Source

fix(admin-ui): List newly-created customers

Fixes #2213
Michael Bromley 2 years ago
parent
commit
6483aad131

+ 13 - 9
packages/admin-ui/src/lib/customer/src/components/customer-list/customer-list.component.ts

@@ -77,15 +77,19 @@ export class CustomerListComponent
                     skip,
                     take,
                     filter: {
-                        emailAddress: {
-                            contains: this.searchTermControl.value,
-                        },
-                        lastName: {
-                            contains: this.searchTermControl.value,
-                        },
-                        postalCode: {
-                            contains: this.searchTermControl.value,
-                        },
+                        ...(this.searchTermControl.value
+                            ? {
+                                  emailAddress: {
+                                      contains: this.searchTermControl.value,
+                                  },
+                                  lastName: {
+                                      contains: this.searchTermControl.value,
+                                  },
+                                  postalCode: {
+                                      contains: this.searchTermControl.value,
+                                  },
+                              }
+                            : {}),
                         ...this.filters.createFilterInput(),
                     },
                     filterOperator: this.searchTermControl.value ? LogicalOperator.OR : LogicalOperator.AND,