From e2955ef5bbea0e072c63d3d897eb53176fa432c7 Mon Sep 17 00:00:00 2001 From: Alex Stan Date: Sat, 1 Jun 2024 11:21:42 +0300 Subject: [PATCH] Use our own API instead of the test one Signed-off-by: Alex Stan --- app/page.tsx | 10 ++++++---- tsconfig.json | 3 ++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/app/page.tsx b/app/page.tsx index e84cac1..0a53772 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -1,7 +1,7 @@ import Image from "next/image"; -async function getData() { - const res = await fetch('https://my-json-server.typicode.com/typicode/demo/posts'); +async function getData( url: string ) { + const res = await fetch( url ); // The return value is *not* serialized // You can return Date, Map, Set, etc. @@ -14,10 +14,12 @@ async function getData() { } export default async function Home() { - const data = await getData(); + const data = await getData( "http://localhost:4000/questions" ); return (
-

{ data[ 1 ].title }

+ { data.map( (item: any) => ( +

{ item.question }

+ ) ) }
); } diff --git a/tsconfig.json b/tsconfig.json index e7ff90f..1fa5c96 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,7 +3,7 @@ "lib": ["dom", "dom.iterable", "esnext"], "allowJs": true, "skipLibCheck": true, - "strict": true, + "strict": false, "noEmit": true, "esModuleInterop": true, "module": "esnext", @@ -12,6 +12,7 @@ "isolatedModules": true, "jsx": "preserve", "incremental": true, + "noImplicitAny": false, "plugins": [ { "name": "next"