let url; fetch('https://ImperfectBigheartedFont.mygyasir8.repl.co/api',{ method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ prompt: '', np: 'beach', seed: 0, gs: 7.5, steps: 50, }), }) .then((response) => response.text()) .then((data) => { url = data prefix = 'data:image/jpeg;base64' console.log(prefix+url) }) .catch((error) => console.error('Error:', error));