Merge branch 'max_dev' of Software_Engineering_I/greenvironment-frontend into master

master
Trivernis 5 years ago committed by Gitea
commit 8b855f700b

@ -117,32 +117,33 @@ export class MainNavigationComponent implements OnInit {
} }
acceptRequest(id: number) { acceptRequest(id: number) {
for (let i = 0; i < this.user.receivedRequests.length; i++) { console.log('try to accept request from id: ' + id);
if (this.user.receivedRequests[i].senderUserID === id) {
this.user.receivedRequests.splice(i, 1);
return;
}
}
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.requestservice.buildJsonAcceptRequest(id)) this.http.post(environment.graphQLUrl, this.requestservice.buildJsonAcceptRequest(id))
.subscribe(response => { .subscribe(response => {
console.log(response); console.log(response);
});
}
denyRequest(id: number) {
for (let i = 0; i < this.user.receivedRequests.length; i++) { for (let i = 0; i < this.user.receivedRequests.length; i++) {
if (this.user.receivedRequests[i].senderUserID === id) { if (this.user.receivedRequests[i].senderUserID === id) {
this.user.receivedRequests.splice(i, 1); this.user.receivedRequests.splice(i, 1);
return; return;
} }
} }
});
}
denyRequest(id: number) {
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.requestservice.buildJsonDenyRequest(id)) this.http.post(environment.graphQLUrl, this.requestservice.buildJsonDenyRequest(id))
.subscribe(response => { .subscribe(response => {
console.log(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