Axios post request: Add data to variable

Hi All

I make a post request with axios:

    search: '',
    skills: [],
    skillName: '',

    addSkill: function(){'skills',{
        skillName: this.skillName
      }).then((response)=>(this.skills =;

When the post request was sucessfully the server sends back the list with the skills, which it sets to the skills variable (then((response)=>(this.skills =
But I would also like to do some other thins there, z.B. set back the skillName to ‘’. How I need to do this?

something like this:

 this.skills =;
 this.skillName = '';

But this is not working.

Thank you very much!

Best regards

I would suggest making a separate method to handle the response so you could reuse for edit also but anyways it would also keep the code cleaner than trying to jam it all in after the response.'skills',{
      skillName: this.skillName
   .then(response => {
   .catch(e => {

and simple handleResponse method:

   // do all your modifications or setting data to whatever in here
   this.skills =;
   this.skillName = '';

But yes basically on the right track

Thank you very much! This solved my problem. :grinning: