Код: Выделить всё
// MyScript.astro
---
const { prop1, prop2 } = Astro.props;
const response = await fetch(import.meta.env.API_URL, {
method: 'POST',
headers: new Headers({
'Content-Type': 'application/json',
'My-Key': import.meta.env.API_KEY,
}),
body: JSON.stringify({
prop1,
prop2
}),
});
const { html } = await response.json();
---
< Strong> Update:
Я использую сейчас:
Код: Выделить всё
Подробнее здесь: https://stackoverflow.com/questions/794 ... -or-body-t
Мобильная версия