fixed request bug

master
Max 5 years ago
parent fee4778f30
commit 5998c8c20f

@ -117,32 +117,33 @@ export class MainNavigationComponent implements OnInit {
}
acceptRequest(id: number) {
for (let i = 0; i < this.user.receivedRequests.length; i++) {
if (this.user.receivedRequests[i].senderUserID === id) {
this.user.receivedRequests.splice(i, 1);
return;
}
}
console.log('try to accept request from id: ' + id);
const headers = new Headers();
headers.set('Content-Type', 'application/json');
this.http.post(environment.graphQLUrl, this.requestservice.buildJsonAcceptRequest(id))
.subscribe(response => {
console.log(response);
for (let i = 0; i < this.user.receivedRequests.length; i++) {
if (this.user.receivedRequests[i].senderUserID === id) {
this.user.receivedRequests.splice(i, 1);
return;
}
}
});
}
denyRequest(id: number) {
for (let i = 0; i < this.user.receivedRequests.length; i++) {
if (this.user.receivedRequests[i].senderUserID === id) {
this.user.receivedRequests.splice(i, 1);
return;
}
}
const headers = new Headers();
headers.set('Content-Type', 'application/json');
this.http.post(environment.graphQLUrl, this.requestservice.buildJsonDenyRequest(id))
.subscribe(response => {
console.log(response);
for (let i = 0; i < this.user.receivedRequests.length; i++) {
if (this.user.receivedRequests[i].senderUserID === id) {
this.user.receivedRequests.splice(i, 1);
return;
}
}
});
}
}

Loading…
Cancel
Save