Rather than creating several putPriority fetches, I\'d ideally just like to pass a singular value.
But this value won\'t be entered via the user (ie not an input field)<
you can use this to get current value :
putPriority: function(e) {
e.preventDefault();
var currentStatus = e.currentTarget.getAttribute("value");
return fetch(DATA_API, {
method: 'PUT',
body: JSON.stringify({
status: currentStatus,
tag: [
{}
]
})
})
.then(function(res){ return res.json(); })
.then(function(data){ alert( JSON.stringify( data ) ) })
},
this will solve your problem
var currentStatus = e.currentTarget.getAttribute("value");