app_lisium/static/js/featureHandler.js
2025-12-13 10:23:28 -06:00

35 lines
1011 B
JavaScript

document.addEventListener('DOMContentLoaded', async function () {
console.log(`Here there be dragons!! and ${feature_uuid}`)
})
async function saveFeature() {
var feature_name = document.getElementById("featureName").value;
var feature_description = document.getElementById("featureDescription").value;
const response = await fetch(`/f/${feature_uuid}/save`, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
key: feature_uuid,
update: {
feature_name: feature_name,
feature_description: feature_description
}
})
});
data = await response.json();
if (data.error){
UIkit.notification({
message: data.message,
status: "danger",
pos: 'bottom-right',
timeout: 5000
});
} else if (!data.error) {
window.location.href = `/f/${feature_uuid}`;
}
};