Portfolio/Websites/UnusedPages/admin/page.tsx

29 lines
876 B
TypeScript

import React, { FormEvent } from "react";
import { Input } from "@/components/ui/input";
import { Button } from "@/components/ui/button";
export default async function Admin() {
const handleSubmit = async (e: FormEvent<HTMLFormElement>) => {
e.preventDefault();
const formData = new FormData(e.currentTarget);
const response = await fetch(`/api/auth/admin`, {
method: "POST",
body: JSON.stringify({
email: formData.get("email"),
password: formData.get("password"),
}),
});
console.log({ response });
};
return (
<form
onSubmit={handleSubmit}
className="flex flex-col gap-2 mx-auto max-w-md mt-20"
>
<Input type="email" placeholder="email" />
<Input type="password" placeholder="password" />
<Button className="bg-blue-500 text-white text-lg">Submit</Button>
</form>
);
}