Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function get(url) {
- return new Promise((r, rj) => {
- var xhr = new XMLHttpRequest()
- xhr.open('GET', url, true)
- xhr.onload = function () {
- var data = JSON.parse(xhr.responseText);
- if (xhr.readyState == 4 && xhr.status == "200") {
- r(data);
- } else {
- rj(data);
- }
- }
- xhr.send(null);
- });
- }
- function del(id) {
- var url = "https://signing.dev.jinjer.info/api/core/contracts/";
- var xhr = new XMLHttpRequest();
- xhr.open("DELETE", url+id, true);
- xhr.onload = function () {
- var data = JSON.parse(xhr.responseText);
- if (xhr.readyState == 4 && xhr.status == "200") {
- console.table(data);
- } else {
- console.error(data);
- }
- }
- xhr.send(null);
- }
- function delay(t){return new Promise(r => setTimeout(r, t));}
- (async () => {
- const data = await get('https://signing.dev.jinjer.info/api/core/contracts')
- for(let c of data.content) {
- await del(c.id)
- await delay(100)
- }
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement