Removing an element from the list
Finally, we will learn how to remove an element from the list. A DELETE
type request will be used for this.
Using Axios with a DELETE type request (client side)
The axios.delete("/list", options)
method is used to trigger a DELETE
type request on the server. The options
parameter must indicate the identifier of the element to be deleted from the collection.
However, unlike the previous axios.get()
, axios.put()
, and axios.post()
calls, the axios.delete("/list", options)
call requires that the options
parameter be written in the data
property (thus written as { data : options }
). If you don’t follow this convention, it won’t work.
Here are the instructions for performing a DELETE
request with the Axios library:
Deleting an element, client side (global-app.js file)
import Element from "./element.js"; const GlobalApp = { data() { return { &...