refactor(visitors-hostel): refactor module and add features#244
refactor(visitors-hostel): refactor module and add features#244Lakshmipriya272 wants to merge 2 commits into
Conversation
feat(visitors-hostel): refactor module and add features
vikrantwiz02
left a comment
There was a problem hiding this comment.
Critical
-
Wrong Redux state path in
RoleBasedAccess.jsxand other components —state.user?.userdoes not exist; the selector should bestate.user.roledirectly. Every component relying on this helper will silently deny access to all users becauseuserRolewill always beundefined. -
19 debug
console.log/console.errorstatements added — statements likeconsole.log("Submitting booking request with payload:", payload)inBookingRequestForm.jsxexpose request data in production browser consoles. These should be removed before merge. -
ForwardBookingForm.jsxhas an unimplementedfetchBookingDatafunction — the body is replaced with aconsole.logand 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.jsxuses emoji inconsole.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 @@ | |||
| /** | |||
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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.
No description provided.