diff --git a/frontend/src/components/partials/LoginForm.tsx b/frontend/src/components/partials/LoginForm.tsx new file mode 100644 index 0000000..313f3d5 --- /dev/null +++ b/frontend/src/components/partials/LoginForm.tsx @@ -0,0 +1,130 @@ +import React, { useState } from "react"; + +import { cn } from "@/lib/utils"; +import { Button } from "@/components/ui/button" +import { Card, CardContent } from "@/components/ui/card" +import { Input } from "@/components/ui/input" +import { Label } from "@/components/ui/label" + +import { login } from "@/services/auth"; + + +export function LoginForm({ + className, + ...props +}: React.ComponentProps<"div">) { + + const [username, setUsername] = useState(""); + const [password, setPassword] = useState(""); + + const handelSubmit = async (e) => { + e.preventDefault(); + try { + await login(username, password); + window.location.href = "/"; + } catch (error) { + alert("Login failed!"); + } + }; + + return ( +
+ + +
+
+
+

Welcome back

+

+ Login to your Gallery Archive account +

+
+
+ + setUsername(e.target.value)} + /> +
+
+ + setPassword(e.target.value)} + /> +
+ + {/*
+ + Or continue with + +
+
+ + + +
*/} +
+ Don't have an account?{" "} + + Sign up + +
+
+
+
+ Image +
+
+
+
+ By clicking continue, you agree to our Terms of Service{" "} + and Privacy Policy. +
+
+ ) +}