//This file contains a function that returns a information about an entry
//this function is called with the elementid and the information one wants to receive
// ----!!! It has to be called with await !!!----
async function elementinfo(element, info) {
try {
response = await fetch('/api/elementinformation.php', {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({ "elementid": element })
});
data = await response.json();
for (key in data){
if(key.includes(info)){
return data[key]
}
}
} catch (error) {
console.error('Error fetching element information: ', error);
throw error;
}
}