From d56594d3289002566f4653d607f0837befd65109 Mon Sep 17 00:00:00 2001 From: polwex Date: Thu, 15 May 2025 10:13:00 +0700 Subject: wtf man --- src/pages/api/auth.ts | 17 +++++++++++++++++ src/pages/login.tsx | 28 ++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 src/pages/api/auth.ts create mode 100644 src/pages/login.tsx (limited to 'src/pages') diff --git a/src/pages/api/auth.ts b/src/pages/api/auth.ts new file mode 100644 index 0000000..3ed9b76 --- /dev/null +++ b/src/pages/api/auth.ts @@ -0,0 +1,17 @@ +import db from "../../lib/db"; +export const POST = async (request: Request): Promise => { + const body = await request.json(); + + if (!body.name || !body.creds) { + return Response.json({ message: "Invalid" }, { status: 400 }); + } + + try { + const res = db.loginUser(body.name, body.creds); + console.log({ res }); + + return Response.json(res, { status: 200 }); + } catch (error) { + return Response.json({ message: "Failure" }, { status: 500 }); + } +}; diff --git a/src/pages/login.tsx b/src/pages/login.tsx new file mode 100644 index 0000000..8ddc1a1 --- /dev/null +++ b/src/pages/login.tsx @@ -0,0 +1,28 @@ +import AuthScreen from "@/components/Login2"; +import { Link } from "waku"; +import db from "@/lib/db"; + +export default async function AuthPage() { + const data = await getData(); + + return ( +
+ +
+ ); +} + +const getData = async () => { + // const data = { + // title: "Waku", + // headline: "Waku", + // body: "Hello world!", + // }; + // return data; +}; + +export const getConfig = async () => { + return { + render: "static", + } as const; +}; -- cgit v1.2.3