blueprint function
This commit is contained in:
@@ -182,6 +182,30 @@ window.sendCommand = async function() {
|
||||
}
|
||||
|
||||
payload = { research_id };
|
||||
} else if (type === 'blueprints') {
|
||||
const blueprint_name = window.selectedBlueprintName;
|
||||
if (!blueprint_name) return alert('Παρακαλώ επιλέξτε Blueprint.');
|
||||
|
||||
try {
|
||||
const res = await fetch('/dashboard/blueprints', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
town_id: town.town_id,
|
||||
blueprint_name: blueprint_name
|
||||
})
|
||||
});
|
||||
const data = await res.json();
|
||||
if (data.ok) {
|
||||
alert(data.is_active ? 'Blueprint ενεργοποιήθηκε!' : 'Blueprint απενεργοποιήθηκε!');
|
||||
window.fetchTowns(); // refresh towns to update UI state
|
||||
} else {
|
||||
alert('Σφάλμα: ' + data.error);
|
||||
}
|
||||
} catch(e) {
|
||||
alert('Failed to toggle blueprint: ' + e);
|
||||
}
|
||||
return; // Exit here as we don't send this to /dashboard/commands
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user