diff --git a/client/src/pages/admin/login.tsx b/client/src/pages/admin/login.tsx new file mode 100644 index 0000000..b70cba7 --- /dev/null +++ b/client/src/pages/admin/login.tsx @@ -0,0 +1,63 @@ +import { useState } from "react"; +import { useLocation } from "wouter"; +import { queryClient, apiRequest } from "../../lib/queryClient"; +import { toast } from "../../hooks/use-toast"; +import { ShoppingBag } from "lucide-react"; + +export default function AdminLogin() { + const [, setLocation] = useLocation(); + const [email, setEmail] = useState(""); + const [password, setPassword] = useState(""); + const [loading, setLoading] = useState(false); + + const handleSubmit = async (e: React.FormEvent) => { + e.preventDefault(); + setLoading(true); + try { + await apiRequest("POST", "/api/admin/login", { email, password }); + await queryClient.invalidateQueries({ queryKey: ["/api/admin/me"] }); + setLocation("/admin"); + } catch (err: any) { + toast({ title: "Sign in failed", description: err.message, variant: "destructive" }); + } finally { + setLoading(false); + } + }; + + return ( +
NoShop Store Management
+