Skip to content

Refactor newsletter form submission to use Fetch API #124

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

apoorvpathak
Copy link

This PR replaces the legacy XMLHttpRequest with the modern Fetch API for handling the newsletter form submission. The update improves code readability, maintainability, and aligns with modern JavaScript best practices.

Changes:

  • Replaced XMLHttpRequest with fetch and async/await

  • Kept all existing functionality intact

  • Improved error handling with try-catch

I tried to keep the changes minimal as this is my first-ever PR to this project. In the future, I plan to enhance the newsletter submission by:

  • Adding a loading spinner for better user experience

  • Displaying an error message if something goes wrong while submitting the email

Looking forward to any feedback and Let me know if you need any refinements!

@apoorvpathak
Copy link
Author

hey @kamilmysliwiec when you have some time, could you please have a look at this PR? thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants