title: Vue/Axios - patch request using form data in url?
body: <p>Im an absolutly beginner in vue/axios/express etc.
  I try to build a rest api to save customer informations.</p>
  <p>A customer has 2 values. A name and a website name.
  Everything works like expected but i cant update the customers</p>
  <p>i guess the problem is that i use the website name to find/delete/update customers like this :</p>
  <pre><code>// express controller : 
      update : async (req,res) =&gt; {
              let customer = await CustomerModel.findOne({website: req.params.website})
              if (req.body.website) {
                  customer.website = req.body.website
              }
              if (req.body.name) {
                  customer.name = req.body.name
              }
              let savedCustomer = await customer.save()
              res.send(savedCustomer)
      },
  
  
  // route
  router.patch('/customer/:website', CustomerController.update) 
  </code></pre>
  <pre><code>// vue/axios : 
  
  // template 
  &lt;template&gt;
    &lt;div class=&quot;content-container pl-15 pr-15&quot; &gt;
      &lt;Customer 
          v-for=&quot;customer in customers&quot; 
          v-bind:key=&quot;customer._id&quot; 
          v-bind:customer=&quot;customer&quot;
          @on-update-customer=&quot;updateCustomer(customer.website,customer.name)&quot;
      /&gt;
    &lt;/div&gt;
  &lt;/template&gt;
  
  // method
  updateCustomer : function(website, customerName) {
     axios
        .patch('http://localhost:3000/api/customer/' + website, {
               name : customerName,
               website : website
        })
  },
  </code></pre>
  <p>the problem is that when i change the website name, axios calls a url with the updated value (which not exist)?</p>
  <p><a href="https://i.stack.imgur.com/wLwTV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wLwTV.png" alt="enter image description here" /></a></p>
  <p>child component :</p>
  <pre><code>&lt;template&gt;
      &lt;div class=&quot;customer mb-15 pt-10 pb-10 pl-10 pr-10&quot;&gt;
              &lt;div class=&quot;customer-header&quot;&gt;
                  &lt;div class=&quot;customer-infos&quot;&gt;
                      &lt;div class=&quot;customer-name mr-15&quot;&gt;
                          &lt;small&gt;Kunde:&lt;/small&gt;
                          &lt;input
                              type=&quot;text&quot;
                              v-model=&quot;customer.name&quot;
                          /&gt;
                      &lt;/div&gt;
                      &lt;div class=&quot;customer-website mr-15&quot;&gt;
                          &lt;small&gt;Webseite:&lt;/small&gt;
                          &lt;input 
                              type=&quot;text&quot;
                              v-model=&quot;customer.website&quot;
                          /&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
                  &lt;div class=&quot;customer-actions pl-15&quot;&gt;
                      &lt;span class=&quot;mr-10&quot;&gt;
                          {{contentList.length &gt; 1 ? contentList.length + ' Inhalte' : contentList.length + ' Inhalt' }} 
                      &lt;/span&gt;
                      &lt;i 
                          :class=&quot;['fas', isHidden ? 'fa-arrow-circle-down show' : 'fa-arrow-circle-up' ]&quot; 
                          title=&quot;Zeige Inhalte&quot;
                          @click=&quot;isHidden = !isHidden&quot;
                      /&gt;
                      &lt;i 
                          class=&quot;far fa-save&quot; 
                          title=&quot;Kundendaten speichern&quot;
                          @click=&quot;$emit('on-update-customer')&quot;
                      /&gt;
                      &lt;i 
                          class=&quot;fas fa-minus-circle remove&quot;
                          title=&quot;Kunde löschen&quot;
                          @click=&quot;$emit('on-delete-customer')&quot;
                      /&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
              ........
  </code></pre>
  <p>Is there any way to fix it? Axios patch request should use the &quot;old&quot; website name in the url but update it to the new one.</p>