I would like to dynamically create the URL path for my axios post action in my vue.js application
Here is the action:
editProduct: function ({dispatch, commit}, payload) {
axios
.put('http://localhost:8081/product/5b5ca691e4f0d93c18e3f6d9', payload)
.then(res => dispatch('loadProducts', res.data))
.catch(function (error) {
console.log(error)
})
.then(() => {
commit('clearAddEditProduct')
})
}
I would like to replace the "5b5ca691e4f0d93c18e3f6d9" with whatever is in the state
state: { // data
product: {
name: '',
description: '',
externalid: '',
active: '',
id: ''
}
Specifically the Product ID
Any suggestions?