diff --git a/compass/.gitignore b/compass/.gitignore index 105a425..4bac83d 100644 --- a/compass/.gitignore +++ b/compass/.gitignore @@ -33,3 +33,6 @@ yarn-error.log* # typescript *.tsbuildinfo next-env.d.ts + +# environment variables +.env \ No newline at end of file diff --git a/compass/app/api/health/route.ts b/compass/app/api/health/route.ts new file mode 100644 index 0000000..d5f889a --- /dev/null +++ b/compass/app/api/health/route.ts @@ -0,0 +1,9 @@ +import { NextResponse } from "next/server"; + +interface ResponseData { + message: string; +} + +export async function GET() { + return NextResponse.json({ message: "Hello World!" }, { status: 200 }); +} diff --git a/compass/app/page.tsx b/compass/app/page.tsx index dba820a..23e9861 100644 --- a/compass/app/page.tsx +++ b/compass/app/page.tsx @@ -1,86 +1,93 @@ // pages/index.tsx "use client"; -import Button from '@/components/Button'; -import Input from '@/components/Input' -import InlineLink from '@/components/InlineLink'; -import Paper from '@/components/auth/Paper'; +import Button from "@/components/Button"; +import Input from "@/components/Input"; +import InlineLink from "@/components/InlineLink"; +import Paper from "@/components/auth/Paper"; // import { Metadata } from 'next' -import Image from 'next/image'; -import {ChangeEvent, useState} from "react"; +import Image from "next/image"; +import { ChangeEvent, useState } from "react"; // export const metadata: Metadata = { // title: 'Login', // } -export default function Page() { - const [email, setEmail] = useState(""); - const [password, setPassword] = useState(""); - const [error, setError] = useState(""); +export default function Page() { + const [email, setEmail] = useState(""); + const [password, setPassword] = useState(""); + const [error, setError] = useState(""); - const handleEmailChange = (event: React.ChangeEvent) => { - setEmail(event.currentTarget.value); - console.log("email " + email); + const testFetch = () => { + const result = fetch("/api/health"); + console.log(result); + }; + + const handleEmailChange = (event: React.ChangeEvent) => { + setEmail(event.currentTarget.value); + console.log("email " + email); + }; + + const handlePasswordChange = (event: React.ChangeEvent) => { + setPassword(event.currentTarget.value); + console.log("password " + password); + }; + + const handleClick = (event: React.MouseEvent) => { + event.preventDefault(); + // Priority: Incorrect combo > Missing email > Missing password + + if (password.trim().length === 0) { + setError("Please enter your password."); } - - const handlePasswordChange = (event: React.ChangeEvent) => { - setPassword(event.currentTarget.value); - console.log("password " + password) + // This shouldn't happen, already provides validation, but just in case. + if (email.trim().length === 0) { + setError("Please enter your email."); } - - const handleClick = (event: React.MouseEvent) => { - event.preventDefault(); - // Priority: Incorrect combo > Missing email > Missing password - - if (password.trim().length === 0) { - setError("Please enter your password.") - } - // This shouldn't happen, already provides validation, but just in case. - if (email.trim().length === 0) { - setError("Please enter your email.") - } - // Placeholder for incorrect email + password combo. - if (email === "incorrect@gmail.com" && password) { - setError("Incorrect password.") - } + // Placeholder for incorrect email + password combo. + if (email === "incorrect@gmail.com" && password) { + setError("Incorrect password."); } + }; - - - return ( - <> - -
- Compass Center logo. -

Login

-
- -
-
- -
-
- - Forgot password? - - - - -
-
-

- © 2024 Compass Center -

-
- - ); -}; \ No newline at end of file + return ( + <> + +
+ Compass Center logo. +

Login

+
+ +
+
+ +
+
+ Forgot password? + + +
+
+

+ © 2024 Compass Center +

+
+ + ); +}