| async function login() { |
| await fetch("/api/register", { |
| method: "POST", |
| headers: {"Content-Type":"application/json"}, |
| body: JSON.stringify({ |
| email: "test@mail.com", |
| password: "1234" |
| }) |
| }); |
| } |
|
|
| async function generate() { |
| let prompt = document.getElementById("prompt").value; |
|
|
| let res = await fetch("/api/generate", { |
| method: "POST", |
| headers: {"Content-Type":"application/json"}, |
| body: JSON.stringify({ |
| prompt, |
| email: "test@mail.com" |
| }) |
| }); |
|
|
| let data = await res.json(); |
|
|
| document.getElementById("result").src = data; |
| } |