20 lines
614 B
JavaScript
20 lines
614 B
JavaScript
function selectBootOption(clientID, bootID) {
|
|
const Http = new XMLHttpRequest;
|
|
var host = window.location.protocol + "//" + window.location.host;
|
|
const url = host + "/config/boot"
|
|
console.debug(`Sending request to ${url}`);
|
|
Http.open("PUT", url);
|
|
Http.setRequestHeader("Content-Type", "application/json");
|
|
const body = JSON.stringify({
|
|
client_id: clientID,
|
|
option_id: bootID,
|
|
});
|
|
Http.onload = () => {
|
|
if (Http.readyState === 4 && Http.status === 202) {
|
|
location.reload();
|
|
} else {
|
|
console.error(`Unexpected returncode ${Http.status}`)
|
|
}
|
|
};
|
|
Http.send(body);
|
|
}
|