⚡ Minor optimizations
This commit is contained in:
parent
550b7ac328
commit
e5a44af210
@ -41,8 +41,8 @@ export class TripCreateModalComponent {
|
||||
image_id: null,
|
||||
});
|
||||
|
||||
if (this.config.data) {
|
||||
let patchValue = this.config.data.trip;
|
||||
const patchValue = this.config.data?.trip;
|
||||
if (patchValue) {
|
||||
if (!patchValue.image_id) delete patchValue["image"];
|
||||
this.tripForm.patchValue(patchValue);
|
||||
}
|
||||
|
||||
@ -43,9 +43,9 @@ export class TripPlaceSelectModalComponent {
|
||||
},
|
||||
});
|
||||
|
||||
if (this.config.data) {
|
||||
let places: Place[] = this.config.data.places;
|
||||
this.selectedPlaces.push(...places);
|
||||
const places: Place[] | undefined = this.config.data?.places;
|
||||
if (places) {
|
||||
this.selectedPlaces = [...places];
|
||||
this.selectedPlacesID = places.map((p) => p.id);
|
||||
}
|
||||
|
||||
@ -56,7 +56,7 @@ export class TripPlaceSelectModalComponent {
|
||||
return;
|
||||
}
|
||||
|
||||
let v = value.toLowerCase();
|
||||
const v = value.toLowerCase();
|
||||
this.displayedPlaces = this.places.filter(
|
||||
(p) =>
|
||||
p.name.toLowerCase().includes(v) ||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user