How to use the superagent.delete function in superagent

To help you get started, we’ve selected a few superagent examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SciCatProject / catamel / test / Logbook.js View on Github external
function deleteTestMessage(roomId) {
    return superagent
        .delete(scichatBaseUrl + `/Rooms/${roomId}/messages`)
        .then(res => {
            return Promise.resolve(res.body);
        })
        .catch(err => {
            console.error(err);
        });
}
github OpenTMI / opentmi / test / tests_api / users.js View on Github external
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);
        });
    });
github mglaman / commerce_cart_api / tests / modules / commerce_cart_reactjs / lib / components / cart-form / cart.js View on Github external
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() {
github L-Leite / cso2-master-server / src / user / usersession.ts View on Github external
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
        }
    }
github L-Leite / cso2-master-server / src / user / usersession.ts View on Github external
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
github xyfir / accownt / client / components / dashboard / user / Service.jsx View on Github external
}, () => {
      request
        .delete('../api/dashboard/user/services/' + this.props.id)
        .end((err, res) => location.reload());
    });
  }
github dbow / futureplate / src / utils / api.js View on Github external
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;
github xyfir / accownt / web / components / dashboard / developer / Delete.jsx View on Github external
onConfirm() {
    request
      .delete('/api/dashboard/developer/services/' + this.props.id)
      .end((err, res) => !err && (location.href = '/dashboard/developer'));
  }
github Autodesk / machine-collaboration-utility / src / Components / Jobs / Job.js View on Github external
handleClick() {
    request
      .delete('/v1/jobs')
      .send({ uuid: this.state.job.uuid })
      .set('Accept', 'application/json')
      .end();
  }
  render() {
github felipemoraes / searchx-frontend / src / js / app / search / features / annotation / AnnotationStore.js View on Github external
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();
};