Browse Source

fix(admin-ui): Fix creation of zone from country list

Michael Bromley 6 years ago
parent
commit
0aa0bc8059

+ 2 - 2
admin-ui/angular.json

@@ -52,13 +52,13 @@
               ],
               "optimization": true,
               "outputHashing": "all",
-              "sourceMap": false,
+              "sourceMap": true,
               "extractCss": true,
               "namedChunks": false,
               "aot": true,
               "extractLicenses": true,
               "vendorChunk": false,
-              "buildOptimizer": true,
+              "buildOptimizer": true
             }
           }
         },

+ 2 - 2
admin-ui/src/app/settings/components/country-list/country-list.component.ts

@@ -95,7 +95,7 @@ export class CountryListComponent implements OnInit, OnDestroy {
                     } else if (selection) {
                         return this.dataService.settings
                             .createZone({
-                                name: selection.name,
+                                name: typeof selection === 'string' ? selection : selection.name,
                                 memberIds: this.selectedCountryIds,
                             })
                             .pipe(map(data => data.createZone));
@@ -181,7 +181,7 @@ export class CountryListComponent implements OnInit, OnDestroy {
             );
     }
 
-    private isZone(input: Zone.Fragment | { name: string }): input is Zone.Fragment {
+    private isZone(input: Zone.Fragment | { name: string } | string): input is Zone.Fragment {
         return input.hasOwnProperty('id');
     }
 }

+ 2 - 2
admin-ui/src/app/settings/components/zone-selector-dialog/zone-selector-dialog.component.ts

@@ -8,10 +8,10 @@ import { Dialog } from '../../../shared/providers/modal/modal.service';
     templateUrl: './zone-selector-dialog.component.html',
     styleUrls: ['./zone-selector-dialog.component.scss'],
 })
-export class ZoneSelectorDialogComponent implements Dialog<GetZones.Zones | { name: string }> {
+export class ZoneSelectorDialogComponent implements Dialog<GetZones.Zones | { name: string } | string> {
     allZones: GetZones.Zones[];
     canCreateNewZone = false;
-    resolveWith: (result?: GetZones.Zones | { name: string }) => void;
+    resolveWith: (result?: GetZones.Zones | { name: string } | string) => void;
     selected: any;
 
     onChange(e) {