<!DOCTYPE html>
<html>
<head>
<title>Custom Widget</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="">
</head>
<body>
<div id="main" >
<div id="header" ></div>
<div id="bodyContent" style="overflow: auto; width: 90%; display: inline; white-space: normal;" ></div>
<div id="foot" ></div>
</div>
<script>
window.TagoIO.onStart((widget) => {
window.widget = widget;
let token_device_custom =
widget.display.parameters.map( (item) => { if(item.key === 'device_custom') return item.value; } );
if(token_device_custom){
let myHeaders = new Headers();
myHeaders.append("device-token", token_device_custom);
let requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
.then(response => response.text())
.then(result => {
let objResult = JSON.parse(result);
bodyContent.innerHTML = result; //objResult.result.bucket.id;
})
.catch(error => bodyContent.innerHTML = 'error: ' + error);
}
//bodyContent.innerHTML = JSON.stringify(widget.display);
});
window.TagoIO.ready();
</script>
</body>
</html>