Minor optimizations

This commit is contained in:
itskovacs 2025-08-06 21:05:16 +02:00
parent 550b7ac328
commit e5a44af210
2 changed files with 6 additions and 6 deletions

View File

@ -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);
}

View File

@ -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) ||