Skip to content

Commit

Permalink
fixed alert issue
Browse files Browse the repository at this point in the history
  • Loading branch information
jupiterBill committed Nov 27, 2023
1 parent 0a3d37a commit e4300a5
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
15 changes: 11 additions & 4 deletions components/contact/Contact.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ const Contact = () => {
const [loading, setLoading] = useState(false)
const [done , setDone] = useState(false)
const message = "Please Wait..."
const [head ,setHead]= useState("Thanks For Choosing Us")
const [body ,setBody]= useState("We'll reach out Soon")
const [Closing ,setClosing]= useState("Stay Tuned 👍")

//email transporter

Expand Down Expand Up @@ -45,7 +48,11 @@ const getMarketCap = async ()=> {
// alert(JSON.stringify(response.data.emails, null, 2));
} catch (error) {
setError(true)
alert("Something Went Wrong Please check if data follows rule");
setLoading(false)
setHead("😢 Oops Something went Wrong")
setBody("Please Try Again")
setClosing("Apologies..")
setDone(true)

}
}
Expand Down Expand Up @@ -84,9 +91,9 @@ const getMarketCap = async ()=> {
)}
{done && (
<Post
head="Thanks For Choosing Us"
Body="We'll reach out Soon"
Closing="Stay Tuned"
head={head}
Body={body}
Closing={Closing}
/>
)}
<p className="font-bold text-center mb-10 md:mb-20 md:mt-10 text-[40px] text-white">Contact Us</p>
Expand Down
4 changes: 3 additions & 1 deletion containers/Footer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Progress from "@/components/shared/Progress";

export default function FooterContainer() {
const [mail,setMail] = useState("")
const [message,setMessage] = useState("")
const [message,setMessage] = useState("an error occured")
const [done, setDone] = useState(false)
const [loading, setLoading] = useState(false)
const handleChange = (e)=>{
Expand All @@ -24,6 +24,8 @@ export default function FooterContainer() {
setLoading(false)
}catch(error){
alert(error)
setDone(true)
setLoading(false)
}


Expand Down
6 changes: 6 additions & 0 deletions pages/unsubscribe/[email].js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ export default function Mail({ mail }) {
setLoading(false)
}catch(error){
alert(error)
setMessage("Something Went Wrong")
setDone(true)
setLoading(false)
}
};
const handleClick = async ()=>{
Expand All @@ -36,6 +39,9 @@ export default function Mail({ mail }) {
setLoading(false)
}catch(error){
alert(error)
setMessage("Something Went Wrong")
setDone(true)
setLoading(false)
}
}
return (
Expand Down

0 comments on commit e4300a5

Please # to comment.