Skip to content

refactor(visitors-hostel): refactor module and add features#244

Open
Lakshmipriya272 wants to merge 2 commits into
FusionIIIT:visitor-hostel-v1from
Lakshmipriya272:visitor-hostel-v1
Open

refactor(visitors-hostel): refactor module and add features#244
Lakshmipriya272 wants to merge 2 commits into
FusionIIIT:visitor-hostel-v1from
Lakshmipriya272:visitor-hostel-v1

Conversation

@Lakshmipriya272

Copy link
Copy Markdown

No description provided.

@vikrantwiz02 vikrantwiz02 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Critical

  • Wrong Redux state path in RoleBasedAccess.jsx and other componentsstate.user?.user does not exist; the selector should be state.user.role directly. Every component relying on this helper will silently deny access to all users because userRole will always be undefined.

  • 19 debug console.log / console.error statements added — statements like console.log("Submitting booking request with payload:", payload) in BookingRequestForm.jsx expose request data in production browser consoles. These should be removed before merge.

  • ForwardBookingForm.jsx has an unimplemented fetchBookingData function — the body is replaced with a console.log and a TODO comment. The form will silently fail to populate when opened with a booking ID. This is incomplete work.

Should Not Be Committed

  • STAGE3_4_CHECKLIST.js — 410-line project-management checklist tracking stage completion. This is not application code and should be removed from the repository.
  • MIGRATION_CHECKLIST.md — empty file, adds no value and should be removed.

Minor

  • components/common/ErrorBoundary.jsx uses emoji in console.group('React Error Boundary Triggered') — inconsistent with the rest of the codebase style.
  • Several TODO comments for backend endpoints that are not yet available (// TODO: Implement GET /api/bookings/{bookingId}/) indicate the frontend is ahead of the backend API surface; these paths will 404 at runtime.

@@ -0,0 +1,410 @@
/**

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a 410-line project-management checklist tracking stage completion, not application code. It should not be committed to the repository — track this in a project board or issue instead.

* @param {boolean} props.showMessage - Show message when access is denied (default: true)
*/
function RoleBasedAccess({ allowedRoles, children, fallback, showMessage = true }) {
const user = useSelector((state) => state.user?.user);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

state.user?.user does not exist in the Redux store — the user object lives at state.user, not state.user.user. This means userRole will always be undefined, and hasAccess will always be false, silently denying access to every user regardless of role. Change to:

const userRole = useSelector((state) => state.user?.role);

nationality: "", // Optional
};

console.log("Submitting booking request with payload:", payload);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Debug console.log logging the full request payload should be removed before merge. It exposes visitor booking data (names, dates, room counts) in the browser console in production.

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.

3 participants