Skip to content

Commit

Permalink
Update ContactUs.jsx
Browse files Browse the repository at this point in the history
  • Loading branch information
PriyanshuValiya authored Oct 24, 2024
1 parent bb5409f commit 6426ecd
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions frontend/src/components/Pages/ContactUs.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,18 @@ const ContactUs = () => {

setIsLoading(true);
try {
const response = await fetch(`${API_URL}/api/contact/contactus`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ mail, subject, message }),
});

if (!response.ok) {
+ throw new Error(`Network response was not ok: ${response.status}`);
+ }

const response = await fetch(`${API_URL}/api/contact/contactus`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ mail, subject, message }),
});
+ if (!response.ok) {
+ throw new Error('Network response was not ok');
+ }
setSubmitted(true);
}
setSubmitted(true);
setTimeout(() => {
setMail('');
Expand Down

0 comments on commit 6426ecd

Please sign in to comment.