2024-09-15 18:11:38 -06:00
|
|
|
function handleErrors(response) {
|
2024-10-30 19:42:02 -06:00
|
|
|
if (!response.ok) {
|
|
|
|
throw Error(response.statusText);
|
|
|
|
}
|
|
|
|
return response;
|
2024-09-15 18:11:38 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
function sendMeow(endpoint) {
|
2024-10-30 19:42:02 -06:00
|
|
|
const request = new XMLHttpRequest();
|
|
|
|
request.open("POST", endpoint);
|
|
|
|
request.send("superSecret=null");
|
|
|
|
console.warn(request.response.text);
|
|
|
|
}
|
|
|
|
|
2024-09-15 18:11:38 -06:00
|
|
|
async function getMeowTimeout(endpoint) {
|
2024-10-30 19:42:02 -06:00
|
|
|
const response = await fetch(endpoint);
|
|
|
|
if (response.status === 423) {
|
|
|
|
meowButton.disabled = true;
|
|
|
|
meowButton.innerHTML = "<span>sleeping...</span>";
|
|
|
|
console.warn("MEOW TIMED OUT");
|
|
|
|
}
|
|
|
|
if (response.status === 100) {
|
|
|
|
meowButton.disabled = false;
|
|
|
|
meowButton.innerHTML = "<span>meow</span>";
|
|
|
|
console.warn("MEOW NOT TIMED OUT");
|
|
|
|
}
|
2024-09-15 18:11:38 -06:00
|
|
|
}
|
2024-10-30 19:42:02 -06:00
|
|
|
|
2024-09-17 20:40:41 -06:00
|
|
|
async function getBeepTimeout(endpoint) {
|
2024-10-30 19:42:02 -06:00
|
|
|
const response = await fetch(endpoint);
|
|
|
|
if (response.status === 423) {
|
|
|
|
beepButton.disabled = true;
|
|
|
|
beepButton.innerHTML = "<span>sleeping...</span>";
|
|
|
|
console.warn("BEEP TIMED OUT");
|
|
|
|
}
|
|
|
|
if (response.status === 100) {
|
|
|
|
beepButton.disabled = false;
|
|
|
|
beepButton.innerHTML = "<span>meow</span>";
|
|
|
|
console.warn("BEEP NOT TIMED OUT");
|
|
|
|
}
|
2024-10-28 16:49:32 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
async function getKaomojiTimeout(endpoint) {
|
2024-10-30 19:42:02 -06:00
|
|
|
const response = await fetch(endpoint);
|
|
|
|
if (response.status === 423) {
|
|
|
|
kaomojiButton.disabled = true;
|
|
|
|
kaomojiButton.innerHTML = "<span>sleeping...</span>";
|
|
|
|
console.warn("KAOMOJI TIMED OUT");
|
|
|
|
}
|
|
|
|
if (response.status === 100) {
|
|
|
|
kaomojiButton.disabled = false;
|
|
|
|
kaomojiButton.innerHTML = "<span>meow</span>";
|
|
|
|
console.warn("KAOMOJI NOT TIMED OUT");
|
|
|
|
}
|
|
|
|
}
|