Skip to content

Conversation

@satyajeetch1991
Copy link

@satyajeetch1991 satyajeetch1991 commented Aug 3, 2025

📌 Feat: Connected frontend pages to live API with full loading state handling

📝 Summary

This PR integrates live API data fetching into the frontend and improves the backend to support it.
Previously, /my-bookings, /rooms, and /rooms/:id were using static dummy data.
Now, these pages fetch data dynamically from the backend and handle all request states (loading, empty, error, success).


✅ Changes Made

Frontend

  • Refactored MyBookings.jsx to fetch live data from /api/bookings.
  • Refactored AllRooms.jsx to fetch live data from /api/rooms.
  • Refactored RoomDetails.jsx to fetch live data from /api/rooms/:id.
  • Added loading spinners and empty/error state messages.

Backend

  • Added API routes:
    • GET /api/rooms – returns all rooms
    • GET /api/rooms/:id – returns single room details
    • GET /api/bookings – returns user bookings
  • Updated server.js with new routes, improved error handling & CORS.
  • Enhanced clerkWebhooks.js with better validation, logging, and error handling.

🧪 Testing

  • Verified frontend pages render loading states while fetching.
  • Empty data displays a helpful message.
  • Error handling shows a user-friendly message.
  • ✅ API endpoints tested locally using Postman & frontend calls.

🚀 Screenshots (Optional)

Add screenshots or GIFs showing loading, error, and success states if possible.


📌 Additional Notes

  • Future enhancement: Implement filters & sorting in AllRooms with API query params.
  • Models Room and Booking should be fully implemented to serve actual DB data.

🔗 Issue Reference

Closes #20

@vercel
Copy link

vercel bot commented Aug 3, 2025

@satyajeetch1991 is attempting to deploy a commit to the Manish's projects Team on Vercel.

A member of the Team first needs to authorize it.

@satyajeetch1991
Copy link
Author

@manishkumar8312 The Vercel checks failed because I don’t have authorization to deploy.
Please review and merge this PR, or re-run the deployment with your Vercel account.

@satyajeetch1991
Copy link
Author

@manishkumar8312 can you review it then assign me and merge it

@manishkumar8312 manishkumar8312 added the gssoc 25 Contributing for Updation label Aug 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc 25 Contributing for Updation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feat: Connect Frontend Pages to Live API Data with Full Loading State Handling

2 participants