Skip to content

Commit

Permalink
[Closes #143] Resolve defaultProp and required prop warnings (#159)
Browse files Browse the repository at this point in the history
* Remove use of defaultProps and replace with default values

* Resolve undefined role prop warning

* Format files
  • Loading branch information
samau3 authored Nov 7, 2024
1 parent 2a736bb commit 6e40cb9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
18 changes: 11 additions & 7 deletions client/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,17 @@ function App() {
<Route
path="/patients/register/:patientId"
element={
<ProtectedRoute
role={user?.role}
restrictedRoles={['FIRST_RESPONDER']}
message={'Patient does not exist.'}
>
<PatientRegistration />
</ProtectedRoute>
user ? (
<ProtectedRoute
role={user?.role}
restrictedRoles={['FIRST_RESPONDER']}
message={'Patient does not exist.'}
>
<PatientRegistration />
</ProtectedRoute>
) : (
<Loader />
)
}
/>

Expand Down
5 changes: 1 addition & 4 deletions client/src/stories/Header/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { Sidebar } from '../../components/Sidebar/Sidebar';
* Buttons for logged out buttons
* @param {PropTypes.InferProps<typeof headerProps>} props
*/
export function Header({ user }) {
export function Header({ user = null }) {
const [drawerOpened, { toggle: toggleDrawer, close: closeDrawer }] =
useDisclosure(false);

Expand Down Expand Up @@ -74,9 +74,6 @@ const headerProps = {
};

Header.propTypes = headerProps;
Header.defaultProps = {
user: null,
};

const loggedOutButtonsProps = {};

Expand Down

0 comments on commit 6e40cb9

Please sign in to comment.