//let window_url = "http://192.168.1.156:8099/"; let window_url = window.location.protocol + "//" + window.location.host + "/"; function RquestsGet(url){ let uri = window_url + url; return fetch(uri,{method: 'GET'}) .then(res => { return res.json(); }) .then(data => { return data; }) .catch(error => { return error; }) } function RquestsPost(url,data){ let uri = window_url + url; return fetch(uri,{ body: JSON.stringify(data), cache: 'no-cache', credentials: 'same-origin', headers: { 'user-agent': 'Mozilla/4.0 MDN Example', 'content-type': 'application/json' }, method: 'POST', mode: 'cors', redirect: 'follow', referrer: 'no-referrer', }) .then(res => { return res.json(); }) .then(data => { return data; }) .catch(error => { return error }) }