From 4bc4694c34f2e5a99767d59c003ed7a6169e0e52 Mon Sep 17 00:00:00 2001 From: phoenix Date: Mon, 29 Jul 2024 08:50:58 +0100 Subject: [PATCH] feat --- .env.sample | 2 ++ src/app/(landing-routes)/hng-test/page.tsx | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.env.sample b/.env.sample index b26c06d8c..9930e94b1 100644 --- a/.env.sample +++ b/.env.sample @@ -1 +1,3 @@ API_URL=https://your-teams-backend-probe-url.com +NEXT_PUBLIC_API_URL= +AUTH_SECRET= \ No newline at end of file diff --git a/src/app/(landing-routes)/hng-test/page.tsx b/src/app/(landing-routes)/hng-test/page.tsx index e75751fd9..72ace695e 100644 --- a/src/app/(landing-routes)/hng-test/page.tsx +++ b/src/app/(landing-routes)/hng-test/page.tsx @@ -2,10 +2,15 @@ import { unstable_noStore as noStore } from "next/cache"; export default async function HNGTEST() { noStore(); - const API_URL = process.env.API_URL || "No API URL provided"; + const API_URL = + process.env.API_URL || + `${process.env.NEXT_PUBLIC_API_URL}/probe` || + "No API URL provided"; let result = {} as { message?: string }; + let text = ""; try { const response = await fetch(API_URL); + text = await response.text(); result = response.ok ? await response.json() : {}; } catch { result = {}; @@ -16,7 +21,7 @@ export default async function HNGTEST() {

HNG TEST BACKEND

Version 0.12

{API_URL}

-

{result?.message}

+

{result?.message || text}

);