• Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
Zeeshanshaikh2

Zeeshanshaikh2

Petcon

Public
Like
Petcon
Home
Code
1
README.md
Branches
1
Pull requests
Remixes
History
Environment variables
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
Code
/
Search
README.md

import React, { useState } from "react"; import { Card, CardContent } from "@/components/ui/card"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { Textarea } from "@/components/ui/textarea";

const LoginPage = ({ onLogin }) => { const [credentials, setCredentials] = useState({ email: "", password: "" }); const [error, setError] = useState(""); const [loading, setLoading] = useState(false);

const handleChange = (e) => { const { name, value } = e.target; setCredentials((prev) => ({ ...prev, [name]: value })); };

const handleSubmit = (e) => { e.preventDefault(); setLoading(true); if (!onLogin) { setError("Login function is missing."); setLoading(false); return; } setTimeout(() => { onLogin(credentials); setLoading(false); }, 1500); };

return (

Login

{error &&

{error}

} {loading ? "Logging in..." : "Login"}

Forgot Password?

); };

const AdoptionForm = ({ petId, petName }) => { const [formData, setFormData] = useState({ name: "", email: "", phone: "", address: "", governmentId: "", reason: "", }); const [submitted, setSubmitted] = useState(false); const [loading, setLoading] = useState(false); const [error, setError] = useState("");

const handleChange = (e) => { const { name, value } = e.target; setFormData((prev) => ({ ...prev, [name]: value })); };

const handleSubmit = async (e) => { e.preventDefault(); setLoading(true); setError(""); try { const response = await fetch("/api/adopt", { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify({ petId, ...formData }), });

  const result = await response.json();
  if (response.ok) {
    setSubmitted(true);
  } else {
    setError(result.message || "Failed to submit adoption request. Try again.");
  }
} catch (error) {
  console.error("Error submitting form:", error);
  setError("Something went wrong. Please try again.");
} finally {
  setLoading(false);
}

};

return (

Adopt {petName}

{submitted ? (

Adoption request submitted successfully!

) : ( {error &&

{error}

} <Button type="submit" className="w-full bg-blue-600 text-white py-2 rounded-lg hover:bg-blue-700" disabled={loading}> {loading ? "Submitting..." : "Submit Application"} )} ); };

export { LoginPage, AdoptionForm };

Code
README.md
FeaturesVersion controlCode intelligenceCLIMCP
Use cases
TeamsAI agentsSlackGTM
DocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Open Source Pledge
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.