From 7c8ae6e172a3e36af8144e679c40287a96ed62c3 Mon Sep 17 00:00:00 2001 From: Valentin Manes Date: Tue, 15 Feb 2022 23:07:06 +0100 Subject: [PATCH] Triggers CORS issue --- ui/pages/index.tsx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/ui/pages/index.tsx b/ui/pages/index.tsx index b7bb42f..28a58d5 100644 --- a/ui/pages/index.tsx +++ b/ui/pages/index.tsx @@ -1,9 +1,25 @@ import type { NextPage } from "next"; +import { useState, useEffect } from "react"; + +const backUrl = "http://localhost:3001"; const Home: NextPage = () => { + const [hello, setHello] = useState("nothing"); + + useEffect(() => { + console.log("fetching...", backUrl); + fetch(backUrl, { credentials: "include" }) + .then((res) => res.json()) + .then((data) => { + console.log("back data:", data); + setHello(data); + }); + }, []); + return ( <>

Home

+

Hello from back? {hello}

); };