summaryrefslogtreecommitdiff
path: root/src/pages
diff options
context:
space:
mode:
authorpolwex <polwex@sortug.com>2025-05-15 10:13:00 +0700
committerpolwex <polwex@sortug.com>2025-05-15 10:13:00 +0700
commitd56594d3289002566f4653d607f0837befd65109 (patch)
treef69685b458419566a78727ce6a8cecd0cdc269a5 /src/pages
parent04509d9207603d9055cf022051763ec05c9214d6 (diff)
wtf man
Diffstat (limited to 'src/pages')
-rw-r--r--src/pages/api/auth.ts17
-rw-r--r--src/pages/login.tsx28
2 files changed, 45 insertions, 0 deletions
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<Response> => {
+ 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 (
+ <div>
+ <AuthScreen />
+ </div>
+ );
+}
+
+const getData = async () => {
+ // const data = {
+ // title: "Waku",
+ // headline: "Waku",
+ // body: "Hello world!",
+ // };
+ // return data;
+};
+
+export const getConfig = async () => {
+ return {
+ render: "static",
+ } as const;
+};