G2-MMS: Update central mess frontend UI to match G2-MMS backend workf…#230
G2-MMS: Update central mess frontend UI to match G2-MMS backend workf…#230Zapper9982 wants to merge 1 commit into
Conversation
vikrantwiz02
left a comment
There was a problem hiding this comment.
Critical
-
Auth token is never null-checked before use — every component reads
localStorage.getItem('authToken')and immediately interpolates it into the Authorization header (Token ${token}). When no token is present this sendsAuthorization: Token nullto the backend, which will fail silently on the client. Check for a missing token and redirect or surface an error before making any request. -
18+ components each read the auth token independently from
localStorage— there is no centralized axios interceptor. Any change to the token key name or storage strategy requires updating every component. This is a maintenance and consistency risk; a single request interceptor should attach the header globally.
Should Not Be Committed
-
VacationSurvey.jsx(551 lines) is unreachable — bothStudentVacationSurveyandCaretakerVacationSurveyare commented out in every import location (StudentIndex.jsx,CaretakerIndex.jsx). The component ships with this PR but can never be rendered. Either wire it up or remove it. -
src/Modules/FileTracking/components/Archive.jsx— changed a single icon (FolderNotch→Folder) in a file entirely unrelated to the Central Mess module. This unrelated modification should not be part of this PR.
Minor
- The commented-out
// import { StudentVacationSurvey }and// component: <StudentVacationSurvey />lines indicate work-in-progress code that should either be completed or removed before merge.
|
|
||
| const getHeaders = () => { | ||
| const token = localStorage.getItem("authToken"); | ||
| return { Authorization: `Token ${token}` }; |
There was a problem hiding this comment.
localStorage.getItem('authToken') returns null when the user is not authenticated. This function passes null directly into the header string, sending Authorization: Token null to the backend. Add a null check:
const getHeaders = () => {
const token = localStorage.getItem('authToken');
if (!token) throw new Error('Not authenticated');
return { Authorization: `Token ${token}` };
};| @@ -0,0 +1,551 @@ | |||
| import React, { useEffect, useState } from "react"; | |||
There was a problem hiding this comment.
This 551-line component is never imported anywhere in the navigation tree — the imports are commented out in both StudentIndex.jsx and CaretakerIndex.jsx. Shipping dead components adds bundle weight and creates confusion. Complete the wiring or remove this file before merging.
| FileText, | ||
| FolderNotch, | ||
| Folder, | ||
| } from "@phosphor-icons/react"; |
There was a problem hiding this comment.
This icon rename (FolderNotch → Folder) is unrelated to the Central Mess module. Changes to FileTracking should go through a separate PR targeting that module.
Issue that this pull request solves
Closes: N/A
Proposed changes
Brief description of what is fixed or changed
This PR updates the Central Mess frontend UI to align with the new G2-MMS backend workflows.
Key changes include:
Types of changes
Put an
xin the boxes that applyChecklist
Put an
xin the boxes that applyScreenshots
Please attach screenshots of the updated Central Mess frontend screens, especially:
Other information
This frontend PR depends on the corresponding G2-MMS backend API changes being merged/deployed.