get :
fetch (url).then(...);
or
var result = await fetch(url);
post :
getDevices = async () => {
const location = window.location.hostname;
const settings = {
method: 'POST',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
}
};
const data = await fetch
.then(response => response.json())
.then(json => {
return json;
})
.catch(e => {
return e
});
return data;
}