I have written an axios POST request as recommended from the npm package documentation like:
var data = {
\'key1\': \'val1\',
\'key2\': \'val2\'
}
ax
Or, if you are using some property from vuejs prototype that can't be read on creation you can also define headers and write i.e.
storePropertyMaxSpeed(){
axios.post('api/property', {
"property_name" : 'max_speed',
"property_amount" : this.newPropertyMaxSpeed
},
{headers : {'Content-Type': 'application/json',
'Authorization': 'Bearer ' + this.$gate.token()}})
.then(() => { //this below peace of code isn't important
Event.$emit('dbPropertyChanged');
$('#addPropertyMaxSpeedModal').modal('hide');
Swal.fire({
position: 'center',
type: 'success',
title: 'Nova brzina unešena u bazu',
showConfirmButton: false,
timer: 1500
})
})
.catch(() => {
Swal.fire("Neuspješno!", "Nešto je pošlo do đavola", "warning");
})
}
},