From 5833282888de8c5f7300fd5e6ec571e29b78143c Mon Sep 17 00:00:00 2001 From: Max Date: Fri, 3 Jan 2020 16:27:05 +0100 Subject: [PATCH] fixed friendrequest bug --- src/app/services/datasharing.service.ts | 6 ++++++ src/app/services/request/request.service.ts | 1 + 2 files changed, 7 insertions(+) diff --git a/src/app/services/datasharing.service.ts b/src/app/services/datasharing.service.ts index bc0d047..7116724 100644 --- a/src/app/services/datasharing.service.ts +++ b/src/app/services/datasharing.service.ts @@ -19,6 +19,12 @@ export class DatasharingService { this.userInfoSource.next(pUserInfo); } + addSentRequestUserID(id: number) { + const user: User = this.userInfoSource.getValue(); + user.sentRequestUserIDs.push(id); + this.changeUserInfo(user); + } + changeChatIDs(pChatIDs: number[]) { this.chatIDsSource.next(pChatIDs); } diff --git a/src/app/services/request/request.service.ts b/src/app/services/request/request.service.ts index 8cf340e..273a823 100644 --- a/src/app/services/request/request.service.ts +++ b/src/app/services/request/request.service.ts @@ -37,6 +37,7 @@ export class RequestService { } public sendFriendRequest(user: User) { + this.data.addSentRequestUserID(user.userID); const headers = new Headers(); headers.set('Content-Type', 'application/json'); this.http.post(environment.graphQLUrl, this.buildJsonRequest(user.userID, 'FRIENDREQUEST'))