Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function deleteTestMessage(roomId) {
return superagent
.delete(scichatBaseUrl + `/Rooms/${roomId}/messages`)
.then(res => {
return Promise.resolve(res.body);
})
.catch(err => {
console.error(err);
});
}
const removeUser = user => new Promise((resolve) => {
superagent.delete(`${api}/users/${user._id}`)
.set('authorization', adminAuthString)
.end(function (error, res) {
expect(error).to.equal(null);
expect(res).to.be.a('Object');
expect(res).to.have.property('status', 200);
resolve(res.body);
});
});
doItemDelete(item, event) {
event.preventDefault();
superagent
.delete(`${baseUrl}/cart/${this.state.cartId}/items/${item.order_item_id}?_format=json`)
.end((err, { body }) => {
this.doCartRefresh();
})
}
doItemsUpdate() {
public static async deleteAll(): Promise {
try {
const res: superagent.Response = await superagent
.delete('http://' + userSvcAuthority() + '/users/session/all')
.accept('json')
if (res.status === 200) {
sessionCache.reset()
return true
}
return false
} catch (error) {
console.error(error)
UserSvcPing.checkNow()
return false
}
}
public static async delete(userId: number): Promise {
try {
const res: superagent.Response = await superagent
.delete('http://' + userSvcAuthority() + '/users/session')
.send({
userId,
})
.accept('json')
if (res.status === 200) {
sessionCache.del(userId)
return true
}
return false
} catch (error) {
console.error(error)
UserSvcPing.checkNow()
return false
}, () => {
request
.delete('../api/dashboard/user/services/' + this.props.id)
.end((err, res) => location.reload());
});
}
const promise = new Promise((resolve, reject) => {
request
.delete(`${API_URL}${path}`)
.end((error, response) => {
if (error) {
reject(error, response && response.body);
} else {
resolve(response.body);
}
});
});
return promise;
onConfirm() {
request
.delete('/api/dashboard/developer/services/' + this.props.id)
.end((err, res) => !err && (location.href = '/dashboard/developer'));
}
handleClick() {
request
.delete('/v1/jobs')
.send({ uuid: this.state.job.uuid })
.set('Accept', 'application/json')
.end();
}
render() {
let _remove_annotation = function(url, position) {
const data = state.annotations[url][position];
request
.delete(`${process.env.REACT_APP_SERVER_URL}/v1/session/${AccountStore.getSessionId()}/annotation`)
.send({
url: url,
annotationId: data._id
})
.end(() => {
_broadcast_change();
});
state.annotations[url] = state.annotations[url].filter((item) => item._id !== data._id);
AnnotationStore.emitChange();
SearchStore.updateMetadata();
};