Fix multiple requests on trip sharing

This commit is contained in:
itskovacs 2025-08-13 22:07:00 +02:00
parent abe545c094
commit 0aee97995e

View File

@ -32,6 +32,7 @@ import {
combineLatest,
forkJoin,
Observable,
of,
switchMap,
take,
tap,
@ -1082,7 +1083,9 @@ export class TripComponent implements AfterViewInit {
this.apiService.postTripDayItem(item, this.trip!.id!, item.day_id),
);
forkJoin(obs$).subscribe({
forkJoin(obs$)
.pipe(take(1))
.subscribe({
next: (items: TripItem[]) => {
const index = this.trip!.days.findIndex((d) => d.id == day_id);
if (index === -1) return;
@ -1210,8 +1213,9 @@ export class TripComponent implements AfterViewInit {
.createSharedTrip(this.trip?.id!)
.pipe(take(1))
.subscribe({
next: () => {
next: (url) => {
this.trip!.shared = true;
this.tripSharedURL$ = of(url);
},
});
}