summaryrefslogtreecommitdiff
path: root/src/pages
diff options
context:
space:
mode:
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;
+};