czekaj na parametry pobierania
interface MyApiData {
name: string;
}
class Example {
async getData(foo: string, bar: string) {
let response = await fetch(
'/LostEnergyCalculation/GetGridAndPieChartsData',
{
method: 'post',
headers:new Headers({
'Content-type': 'application/x-www-form-urlencoded; charset=UTF-8'
}),
body: `foo=${foo}&bar=${bar}`
});
let data: MyApiData = await response.json();
return data;
}
}
const example = new Example();
example.getData('foovalue', 'barvalue').then((data) => {
alert(data.name);
});
Busy Boar