form
This commit is contained in:
@@ -6,6 +6,7 @@ import { Textarea } from "@/components/ui/textarea";
|
||||
import { Label } from "@/components/ui/label";
|
||||
import { ArrowLeft, Send } from "lucide-react";
|
||||
import { useToast } from "@/hooks/use-toast";
|
||||
import { createContactDocument } from "@/lib/appwrite";
|
||||
|
||||
const Contact = () => {
|
||||
const { toast } = useToast();
|
||||
@@ -30,16 +31,23 @@ const Contact = () => {
|
||||
e.preventDefault();
|
||||
setIsSubmitting(true);
|
||||
|
||||
// Simulate form submission
|
||||
await new Promise((resolve) => setTimeout(resolve, 1000));
|
||||
|
||||
toast({
|
||||
title: "Nachricht gesendet!",
|
||||
description: "Wir melden uns innerhalb von 24 Stunden bei Ihnen.",
|
||||
});
|
||||
|
||||
setFormData({ name: "", email: "", company: "", message: "" });
|
||||
setIsSubmitting(false);
|
||||
try {
|
||||
await createContactDocument(formData);
|
||||
toast({
|
||||
title: "Nachricht gesendet!",
|
||||
description: "Wir melden uns innerhalb von 24 Stunden bei Ihnen.",
|
||||
});
|
||||
setFormData({ name: "", email: "", company: "", message: "" });
|
||||
} catch (err) {
|
||||
const message = err instanceof Error ? err.message : "Speichern fehlgeschlagen.";
|
||||
toast({
|
||||
variant: "destructive",
|
||||
title: "Fehler beim Senden",
|
||||
description: message,
|
||||
});
|
||||
} finally {
|
||||
setIsSubmitting(false);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user