How to use the axios.delete function in axios

To help you get started, we’ve selected a few axios 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 gardener / dashboard / frontend / src / utils / api.js View on Github external
function deleteResource (url) {
  return axios.delete(url)
}
github codenesium / samples / CAD / CAD.Api.TypeScript / src / react / src / components / callStatus / callStatusSearchForm.tsx View on Github external
handleDeleteClick(e: any, row: Api.CallStatusClientResponseModel) {
    axios
      .delete(Constants.ApiEndpoint + ApiRoutes.CallStatus + '/' + row.id, {
        headers: GlobalUtilities.defaultHeaders(),
      })
      .then(resp => {
        this.setState({
          ...this.state,
          deleteResponse: 'Record deleted',
          deleteSuccess: true,
          deleteSubmitted: true,
        });
        this.loadRecords(this.state.searchValue);
      })
      .catch((error: AxiosError) => {
        GlobalUtilities.logError(error);
        this.setState({
          ...this.state,
github codenesium / samples / Nebula / Nebula.Api.TypeScript / src / react / src / components / linkLog / linkLogSearchForm.tsx View on Github external
handleDeleteClick(e: any, row: Api.LinkLogClientResponseModel) {
    axios
      .delete(Constants.ApiEndpoint + ApiRoutes.LinkLogs + '/' + row.id, {
        headers: GlobalUtilities.defaultHeaders(),
      })
      .then(resp => {
        this.setState({
          ...this.state,
          deleteResponse: 'Record deleted',
          deleteSuccess: true,
          deleteSubmitted: true,
        });
        this.loadRecords(this.state.searchValue);
      })
      .catch((error: AxiosError) => {
        GlobalUtilities.logError(error);
        this.setState({
          ...this.state,
github codenesium / samples / AdventureWorks / AdventureWorks.Api.TypeScript / src / react / src / components / product / productSearchForm.tsx View on Github external
handleDeleteClick(e: any, row: Api.ProductClientResponseModel) {
    axios
      .delete(
        Constants.ApiEndpoint + ApiRoutes.Products + '/' + row.productID,
        {
          headers: {
            'Content-Type': 'application/json',
          },
        }
      )
      .then(
        resp => {
          this.setState({
            ...this.state,
            deleteResponse: 'Record deleted',
            deleteSuccess: true,
            deleteSubmitted: true,
          });
github adr1enbe4udou1n / laravel-boilerplate / resources / js / backend / components / Plugins / DataTable.vue View on Github external
async deleteRow(params) {
      let result = await window.swal({
        title: this.$t('labels.are_you_sure'),
        type: 'warning',
        showCancelButton: true,
        cancelButtonText: this.$t('buttons.cancel'),
        confirmButtonColor: '#dd4b39',
        confirmButtonText: this.$t('buttons.delete')
      })

      if (result.value) {
        try {
          let { data } = await axios.delete(
            this.$app.route(this.deleteRoute, params)
          )
          this.onContextChanged()
          this.$app.noty[data.status](data.message)
        } catch (e) {
          this.$app.error(e)
        }
      }
    },
    async onBulkAction() {
github NERC-CEH / datalab / code / workspaces / infrastructure-api / src / kubernetes / serviceApi.js View on Github external
function deleteService(name) {
  logger.info('Deleting service: %s', name);
  return axios.delete(`${SERVICE_URL}/${name}`)
    .then(response => response.data)
    .catch(handleDeleteError('service', name));
}
github codenesium / samples / CAD / CAD.Api.TypeScript / src / react / src / components / personType / personTypeSearchForm.tsx View on Github external
handleDeleteClick(e: any, row: Api.PersonTypeClientResponseModel) {
    axios
      .delete(Constants.ApiEndpoint + ApiRoutes.PersonTypes + '/' + row.id, {
        headers: GlobalUtilities.defaultHeaders(),
      })
      .then(resp => {
        this.setState({
          ...this.state,
          deleteResponse: 'Record deleted',
          deleteSuccess: true,
          deleteSubmitted: true,
        });
        this.loadRecords(this.state.searchValue);
      })
      .catch((error: AxiosError) => {
        GlobalUtilities.logError(error);
        this.setState({
          ...this.state,
github gotify / server / ui / src / actions / MessageAction.ts View on Github external
export function deleteMessagesByApp(id: number) {
    if (id === -1) {
        axios.delete(config.get('url') + 'message').then(() => {
            dispatcher.dispatch({type: 'DELETE_MESSAGES', payload: -1});
            snack('Messages deleted');
        });
    } else {
        axios.delete(config.get('url') + 'application/' + id + '/message').then(() => {
            dispatcher.dispatch({type: 'DELETE_MESSAGES', payload: id});
            snack('Deleted all messages from the application');
        });
    }
}
github chingu-voyage5 / BitHelper / src / js / apiCalls.js View on Github external
deleteProject(data, next) {
    axios.delete(apiUrl + '/api/projects/' + data._id)
    .then(res => {
      next({data: res.data});
    })
    .catch(err => {
      next({error: err});
      throw err;
    });
  }
};