Praxis_Bot/user_client/v1/webclient.js
2021-05-08 19:07:35 -04:00

60 lines
1.5 KiB
JavaScript

refresh = () => response = fetch('http://127.0.0.1:5500/')
.then((response) => {
return response.text();
})
ConnectionTest = async () => {
var a = await refresh();
console.log(a)
return a
}
async function BotStatus() {
var connectionStatus = await ConnectionTest();
document.getElementById("BotStatus").innerHTML = connectionStatus;
}
BotStatus();
fetch_GetList = (fetchURL) => response = fetch(fetchURL)
.then((response) => {
return response.text();
})
myObj = {
'request_name': "Chyron",
'request_type': "list"
};
params = "?request_name="+encodeURIComponent(myObj.request_name)+"&"+"request_type="+encodeURIComponent(myObj.request_type);
url = "http://127.0.0.1:5500/api/v1/user_client/get"+params;
GetList = async (listType) => {
if (listType == "Chyron") {
chyronListRequestOBJ = {
'request_name': "Chyron",
'request_type': "list"
}
params = "?request_name="+encodeURIComponent(chyronListRequestOBJ.request_name)+"&"+"request_type="+encodeURIComponent(chyronListRequestOBJ.request_type);
targetURL = "http://127.0.0.1:5500/api/v1/user_client/get"+params;
console.log(targetURL)
a = await fetch_GetList(targetURL);
console.log(a);
return a
}
else {
return None
}
}
async function GetListChyron() {
returnedList = await GetList("Chyron");
obj = JSON.parse(returnedList);
console.log(obj["message"])
return returnedList
}
GetListChyron();