diff --git a/backend/artistsmgmt/__pycache__/views.cpython-310.pyc b/backend/artistsmgmt/__pycache__/views.cpython-310.pyc index ccd43b9..3659020 100644 Binary files a/backend/artistsmgmt/__pycache__/views.cpython-310.pyc and b/backend/artistsmgmt/__pycache__/views.cpython-310.pyc differ diff --git a/backend/artistsmgmt/views.py b/backend/artistsmgmt/views.py index 9a7eebc..f4e4bca 100644 --- a/backend/artistsmgmt/views.py +++ b/backend/artistsmgmt/views.py @@ -227,9 +227,9 @@ def send_sms(request): class SendEmailView(APIView): def post(self, request, *args, **kwargs): try: - sender_email = request.POST.get('email') - subject = request.POST.get('subject') - message = request.POST.get('message') + sender_email = request.data.get('email') + subject = request.data.get('subject') + message = request.data.get('message') recipient_email = 'warrenshiv@gmail.com' if sender_email is None or subject is None or message is None: diff --git a/backend/backend/__pycache__/settings.cpython-310.pyc b/backend/backend/__pycache__/settings.cpython-310.pyc index f936d28..a0807d2 100644 Binary files a/backend/backend/__pycache__/settings.cpython-310.pyc and b/backend/backend/__pycache__/settings.cpython-310.pyc differ diff --git a/backend/backend/settings.py b/backend/backend/settings.py index 4d7d8f6..c8edc0c 100644 --- a/backend/backend/settings.py +++ b/backend/backend/settings.py @@ -169,5 +169,5 @@ EMAIL_PORT = 587 EMAIL_USE_TLS = True EMAIL_USE_SSL = False -EMAIL_HOST_USER = 'warrenshiv@gmail.com' +EMAIL_HOST_USER = '' EMAIL_HOST_PASSWORD = config('EMAIL_HOST_PASSWORD') diff --git a/frontend/src/components/profile/ContactForm.js b/frontend/src/components/profile/ContactForm.js index 3d42d4a..10e199f 100644 --- a/frontend/src/components/profile/ContactForm.js +++ b/frontend/src/components/profile/ContactForm.js @@ -1,43 +1,94 @@ -import React from 'react'; +import React, { useState } from "react"; +import axios from "axios"; const ContactForm = () => { + const [formData, setFormData] = useState({ + name: "", + email: "", + subject: "", + message: "", + }); + + const [successMessage, setSuccessMessage] = useState(""); + + const handleChange = (e) => { + const { name, value } = e.target; + setFormData((prevData) => ({ + ...prevData, + [name]: value, + })); + }; + + const handleSubmit = async (e) => { + e.preventDefault(); + + // const { name, ...dataWithoutName } = formData; + + try { + // Make a POST request to the backend + const response = await axios.post( + "http://127.0.0.1:8000/api/send-email/", + formData + ); + + if (response.status === 200) { + setSuccessMessage("Email sent successfully!"); + setFormData({ + name: "", + email: "", + subject: "", + message: "", + }); + + setTimeout(() => { + setSuccessMessage(""); + }, 3000); + } + } catch (error) { + // Error + console.error("Error sending form data: ", error); + } + }; + const iconStyle = { - fontSize: '30px', - color: '#03C04A', - marginRight: '10px', + fontSize: "30px", + color: "#03C04A", + marginRight: "10px", }; const buttonStyle = { - backgroundColor: '#03C04A', - color: '#fff', - fontSize: '1.5rem', + backgroundColor: "#03C04A", + color: "#fff", + fontSize: "1.5rem", }; - const bodyStyle = { - backgroundColor: '#54626F', - color: '#fff', - }; - // style={bodyStyle} + // const bodyStyle = { + // backgroundColor: '#54626F', + // color: '#fff', + // }; return ( -
+
-
Contact
+
+ Contact +
-
-
-
- - {/* Info Items */} +
+
+
- +

Location:

A108 Adam Street, New York, NY 535022

@@ -57,7 +108,10 @@ const ContactForm = () => {
- +

Email:

info@example.com

@@ -69,37 +123,72 @@ const ContactForm = () => { {/* Contact Form */}
-
- + {successMessage && ( +
+

{successMessage}

+
+ )} +
- +
- +
- +
- +
- {/* Add space using Bootstrap spacing utility class (mt-3) */}
- +
-
-