fixed friendrequest bug

master
Max 5 years ago
parent 47b7d1853f
commit 5833282888

@ -19,6 +19,12 @@ export class DatasharingService {
this.userInfoSource.next(pUserInfo); this.userInfoSource.next(pUserInfo);
} }
addSentRequestUserID(id: number) {
const user: User = this.userInfoSource.getValue();
user.sentRequestUserIDs.push(id);
this.changeUserInfo(user);
}
changeChatIDs(pChatIDs: number[]) { changeChatIDs(pChatIDs: number[]) {
this.chatIDsSource.next(pChatIDs); this.chatIDsSource.next(pChatIDs);
} }

@ -37,6 +37,7 @@ export class RequestService {
} }
public sendFriendRequest(user: User) { public sendFriendRequest(user: User) {
this.data.addSentRequestUserID(user.userID);
const headers = new Headers(); const headers = new Headers();
headers.set('Content-Type', 'application/json'); headers.set('Content-Type', 'application/json');
this.http.post(environment.graphQLUrl, this.buildJsonRequest(user.userID, 'FRIENDREQUEST')) this.http.post(environment.graphQLUrl, this.buildJsonRequest(user.userID, 'FRIENDREQUEST'))

Loading…
Cancel
Save