|
|
@ -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);
|
|
|
|
|
|
|
|
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) {
|
|
|
|
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();
|
|
|
|
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;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|