Skip to content

Commit

Permalink
Merge pull request #484 from nishant0708/Get_notified_first
Browse files Browse the repository at this point in the history
User Dashboard Enhancement #481
  • Loading branch information
usha-madithati authored Jul 31, 2024
2 parents e3b879d + 96bbafb commit e5468e7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/components/PForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const PForm = () => {
const [loading, setLoading] = useState(false);
const [notificationMessage, setNotificationMessage] = useState("");
const [notificationTimeout, setNotificationTimeout] = useState(null);
const [hasNotified, setHasNotified] = useState(false);
const [canRedirect, setCanRedirect] = useState(false);

useEffect(() => {
Expand Down Expand Up @@ -57,6 +58,7 @@ const PForm = () => {
setNotificationTimeout(null);
}, 50000);
setNotificationTimeout(timeoutId);
setHasNotified(true);
} else {
alert(`Set notification for ${notifyDays} days`);
}
Expand All @@ -69,6 +71,10 @@ const PForm = () => {
const handleStore = async (e) => {
e.preventDefault();
setLoading(true);
if (!hasNotified) { // Check if the user has clicked "Get Notified"
setLoading(false);
return toast.error("Please click 'Get Notified' before storing the product.");
}

const formattedProductData = {
...productData,
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Contact.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const CustomerVoices = () => {
const handleSubmit = async (e) => {
e.preventDefault();
try {
const response = await axios.post("http://localhost:6352/contactus", {
const response = await axios.post("https://smartserver-scbe.onrender.com/contactus", {
name,
email,
message,
Expand Down

0 comments on commit e5468e7

Please sign in to comment.