Skip to content

Commit

Permalink
Integrate chat persistence
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan-vdm committed Sep 27, 2023
1 parent 922692f commit 134a9d0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
16 changes: 16 additions & 0 deletions libs/app/api/src/lib/app-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
IEventId,
IGetAllEventCategoriesResponse,
IGetAllEventsResponse,
IGetEventChatMessagesResponse,
IGetEventDevicePositionResponse,
IGetEventFloorlayoutImageResponse,
IGetEventFloorlayoutResponse,
Expand Down Expand Up @@ -576,4 +577,19 @@ export class AppApiService {
return response;
});
}

async getEventChats(eventId: string) : Promise<IGetEventChatMessagesResponse> {
return firstValueFrom(
this.http.get<IGetEventChatMessagesResponse>(
`/api/event/getEventChats?eventId=${eventId}`,
{
headers: {
'x-csrf-token': this.cookieService.get('csrf'),
},
}
)
).then((response) => {
return response;
});
}
}
3 changes: 3 additions & 0 deletions libs/app/components/src/lib/streaming/streaming.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ export class StreamingComponent implements OnInit, AfterViewInit {
}

async ngAfterViewInit() {
this.appApiService.getEventChats(this.eventID).then((data) => {
this.eventMessages = data.messages;
});
this.consumer_component.eventID = this.eventID;
await this.consumer_component.connect();
this.socket = this.consumer_component.socket;
Expand Down

0 comments on commit 134a9d0

Please sign in to comment.