Basic Idea

This commit is contained in:
Alex Orid 2021-05-08 19:07:35 -04:00
parent e80db3449a
commit b1d622826f
2 changed files with 20 additions and 7 deletions

View File

@ -35,7 +35,7 @@ def init():
print("starting up... ",) print("starting up... ",)
def handle_request_get(requestName, requestType): def handle_request_get(requestName, requestType):
return flask.make_response("{\"message\":Handled}", 200, {"Content-Type": "application/json"}) return flask.make_response("{\"message\": \"%s\"}" % "message123123", 200, {"Content-Type": "application/json"})
def handle_request_set(requestName, requestType, requestData): def handle_request_set(requestName, requestType, requestData):
pass pass

View File

@ -22,14 +22,25 @@ fetch_GetList = (fetchURL) => response = fetch(fetchURL)
return response.text(); 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) => { GetList = async (listType) => {
if (listType == "Chyron") { if (listType == "Chyron") {
encodedString = encodeURIComponent({ chyronListRequestOBJ = {
'request_name': "Chyron", 'request_name': "Chyron",
'request_type': "list" 'request_type': "list"
}) }
targetURL = 'http://127.0.0.1:5500/api/v1/user_client/get?' + encodedString params = "?request_name="+encodeURIComponent(chyronListRequestOBJ.request_name)+"&"+"request_type="+encodeURIComponent(chyronListRequestOBJ.request_type);
var a = await fetch_GetList(targetURL); targetURL = "http://127.0.0.1:5500/api/v1/user_client/get"+params;
console.log(targetURL)
a = await fetch_GetList(targetURL);
console.log(a); console.log(a);
return a return a
} }
@ -39,8 +50,10 @@ GetList = async (listType) => {
} }
async function GetListChyron() { async function GetListChyron() {
var returnedList = await GetList("Chyron"); returnedList = await GetList("Chyron");
obj = JSON.parse(returnedList);
console.log(obj["message"])
return returnedList
} }
GetListChyron(); GetListChyron();