How to use the axios.patch 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 netlify / www-post-scheduler / lib / github / updateGithubComment.js View on Github external
module.exports = function updateGithubComment(commentID, message) {
  /* /repos/:owner/:repo/issues/comments/:id */
  const commentAPI = `https://api.github.com/repos/${GITHUB_REPO}/issues/comments/${commentID}`
  return axios.patch(commentAPI, {
    "body": message,
  }, config).then(function(response) {
    console.log('patch response', response)
    return response
  });
}
github synzen / Discord.RSS / src / web / client / src / js / components / ControlPanel / ContentBody / Server / Feeds / index.js View on Github external
modalConfirmEdits = feedId => {
    const title = this.state.title.trim()
    const channel = this.state.channel.trim()
    const { csrfToken, guildId, feeds } = this.props
    const feed = feeds[guildId][feedId] || {}
    if ((title === feed.title && !this.state.channel) || (channel === feed.channel && !title) || (title === feed.title && channel === feed.channel) || (!title && !channel)) return this.modalClose()
    this.setState({ saving: true, title, channel })
    const toSend = {}
    if (channel) toSend.channel = channel
    if (title) toSend.title = title
    if (Object.keys(toSend).length === 0) return this.modalClose()
    axios.patch(`/api/guilds/${guildId}/feeds/${feedId}`, toSend, { headers: { 'CSRF-Token': csrfToken } }).then(() => {
      this.modalClose(true)
      toast.success(`Changes saved. Yay!`)
    }).catch(err => {
      console.log(err.response || err)
      const errMessage = err.response && err.response.data && err.response.data.message ? err.response.data.message : err.response && err.response.data ? err.response.data : err.message
      this.setState({ saving: false })
      toast.error(<p>Failed to save<br><br>{errMessage ? typeof errMessage === 'object' ? JSON.stringify(errMessage, null, 2) : errMessage : 'No details available'}</p>)
    })
  }
github FlowzPlatform / website-builder / src / views / ProjectStats.vue View on Github external
updateUserRole (index, id) {
			axios.patch(config.baseURL + '/website-users/' + id, {
				role: this.websiteUsers[index].UserRole
			})
				.then((res) => {
					console.log(res.data)
				})
				.catch((e) => {
					console.log(e)
				})
		},
		deleteUser (id) {
github happylolonly / events-free-spa / client / src / pages / EventPage / Tags / Tags.js View on Github external
saveTags = async () => {
    try {
      await axios.patch(`${API}/event-tag`, {
        id: this.props.id,
        tags: this.state.tags
      });

      this.props.routerHistory.push("/somepath");
    } catch (error) {
      console.log(error);
    }
  };
github algorithm-visualizer / algorithm-visualizer / src / apis / index.js View on Github external
return request(URL, (mappedURL, args) => {
    const [body, params, cancelToken] = args;
    return axios.patch(mappedURL, body, { params, cancelToken });
  });
};
github kiraka / annict-web / app / frontend / javascript / v6 / controllers / program-selector-controller.ts View on Github external
change() {
    const newProgramId = this.selectTarget.value

    if (newProgramId !== this.currentProgramId) {
      this.element.setAttribute('disabled', 'true');

      axios
        .patch(`/api/internal/library_entries/${this.libraryEntryIdValue}`, {
          program_id: newProgramId,
        })
        .then(() => {
          this.currentProgramId = newProgramId
          this.element.removeAttribute('disabled');
          this.reloadList()
        });
    }
  }
}
github davellanedam / vue-skeleton-mvp / src / services / api / adminUsers.js View on Github external
editUser(id, payload) {
    return axios.patch(`/users/${id}`, payload)
  },
  saveUser(payload) {
github DisnodeTeam / disnode-bot / core / api / apiutils.js View on Github external
return new Promise(function(resolve, reject) {
    axios.patch(DiscordURL + endpoint,data,{headers: {'Authorization': "Bot " + key}})
    .then(function(response){
      return resolve(response.data);
    })
    .catch(function(error){
      if(!error.response){
        error.response = {
          data: error,
          status: error.code
        }
      }

      var ErrorObject = {
        message: error.response.data.message,
        status: error.response.status,
        display: "Error ["+error.response.status+"] " + error.response.data.message,
        raw: error
github devfake / flox / client / app / components / Content / Subpage.vue View on Github external
refreshInfos() {
        this.SET_LOADING(true);
        this.SET_ITEM_LOADED_SUBPAGE(false);

        http.patch(`${config.api}/refresh/${this.item.id}`).then(response => {
          location.reload();
        }, error => {
          alert(error);
          this.SET_LOADING(false);
        })
      }
    },
github joelnet / MojiScript / net / axios.js View on Github external
module.exports.patch = url => data => options => axios.patch(url, data, options)