Spaces:
Sleeping
Sleeping
"use client"; | |
import Link from "next/link"; | |
export default function Home() { | |
async function start() { | |
const resp = await fetch( | |
`${process.env.API_URL || "http://localhost:8000"}/start`, | |
{ | |
method: "POST", | |
mode: "cors", | |
cache: "no-cache", | |
credentials: "same-origin", | |
headers: { | |
"Content-Type": "application/json", | |
}, | |
body: JSON.stringify({}), | |
} | |
); | |
const data = await resp.json(); | |
console.log(data); | |
} | |
return ( | |
<main className="flex min-h-screen flex-col items-center justify-between p-24"> | |
<Link href="/test">Test</Link> | |
<hr /> | |
<span onClick={() => start()}>Connect</span> | |
</main> | |
); | |
} | |