Attempting to pass JSON body for deletion through angular JS -- 3
£10-20 GBP
Closed
Posted about 4 years ago
£10-20 GBP
Paid on delivery
Attempting to pass JSON body for deletion through angular JS
I've currently got an endpoint that relies on a JSON body in order for deletion to happen. This is the following code:
if ([login to view URL] > 0) {
var deleteRequest = [];
for (var i = 0; i < [login to view URL]; i++) {
var service = {};
[login to view URL] = $[login to view URL][toDeleteService[i]].serviceId;
[login to view URL](service);
}
var deleteUrl = "api/class/" + $scope.targetEntity.serviceId+ "/student";
await asyncDeleteUrl(deleteUrl, deleteRequest);
}
async function asyncDeleteUrl(deleteUrl, toBeDeleted) {
return new Promise(function (resolve, reject) {
$[login to view URL](deleteUrl, toBeDeleted)
.then(function (response) {
resolve(response);
},
function (errorResponse) {
reject(errorResponse);
$[login to view URL]('Bad Modification Interrupted', errorResponse);
});
});
}
I keep getting an error saying the required rest body is missing but I'm not sure why that would be the case. Any help would be appreciated, thank you.