Skip to content

Commit

Permalink
Fix event not returning event
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan-vdm committed Sep 27, 2023
1 parent 400a9cd commit fb56c94
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
5 changes: 3 additions & 2 deletions libs/app/api/src/lib/app-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,14 @@ export class AppApiService {
}

async getEvent(eventId: IEventId): Promise<IEvent> {
return firstValueFrom(
this.http.get<IEvent>(`/api/event/getEvent?eventId=${eventId.eventId}`, {
const data = await firstValueFrom(
this.http.get<IGetEventResponse>(`/api/event/getEvent?eventId=${eventId.eventId}`, {
headers: {
'x-csrf-token': this.cookieService.get('csrf'),
},
})
);
return data.event;
}

async getAllEvents(): Promise<IEvent[]> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ export class EventDetailsPageComponent implements OnInit, AfterViewInit {
}

this.event = (
(await this.appApiService.getEvent({ eventId: this.id })) as any
).event;
(await this.appApiService.getEvent({ eventId: this.id }))
);

if (this.event === null) {
this.ngZone.run(() => { this.router.navigate(['/home']); });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2437,8 +2437,8 @@ export class FloorplanEditorPageComponent implements OnInit, AfterViewInit{
}

this.event = (
(await this.appApiService.getEvent({ eventId: this.id })) as any
).event;
(await this.appApiService.getEvent({ eventId: this.id }))
);

if (this.event === null) {
this.ngZone.run(() => { this.router.navigate(['/home']); });
Expand Down
4 changes: 2 additions & 2 deletions libs/app/components/src/lib/streaming/streaming.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ export class StreamingComponent implements OnInit, AfterViewInit {

if (role === 'admin') {
this.event = (
(await this.appApiService.getEvent({ eventId: this.eventID })) as any
).event;
(await this.appApiService.getEvent({ eventId: this.eventID }))
);
} else {
this.event = (
(await this.appApiService.getSubscribedEvents()) as any
Expand Down

0 comments on commit fb56c94

Please sign in to comment.