37 lines
1.1 KiB
JavaScript
37 lines
1.1 KiB
JavaScript
async function updateEnemy() {
|
|
const factionId = parseInt(document.getElementById("enemyId").value);
|
|
const interval = parseInt(document.getElementById("refreshInterval").value);
|
|
|
|
if (!factionId || !interval) {
|
|
alert("Please enter Enemy Faction ID and Refresh Interval!");
|
|
return;
|
|
}
|
|
|
|
await fetch(`/api/update_enemy_faction`, {
|
|
method: "POST",
|
|
headers: {"Content-Type": "application/json"},
|
|
body: JSON.stringify({ faction_id: factionId, interval: interval })
|
|
});
|
|
}
|
|
|
|
async function updateFriendly() {
|
|
const factionId = parseInt(document.getElementById("friendlyId").value);
|
|
|
|
if (!factionId) {
|
|
alert("Please enter Friendly Faction ID!");
|
|
return;
|
|
}
|
|
|
|
const interval = parseInt(document.getElementById("refreshInterval").value);
|
|
if (!interval) {
|
|
alert("Please enter Refresh Interval!");
|
|
return;
|
|
}
|
|
|
|
await fetch(`/api/update_friendly_faction`, {
|
|
method: "POST",
|
|
headers: {"Content-Type": "application/json"},
|
|
body: JSON.stringify({ faction_id: factionId, interval: interval })
|
|
});
|
|
}
|