Skip to content

Commit

Permalink
Temporary sidebar changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ya5er committed Jul 16, 2024
1 parent 8796d6c commit fb4c507
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
9 changes: 5 additions & 4 deletions frontend/src/components/auth/PrivateRoute.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ const PrivateRoute: React.FC<{ children: React.ReactElement }> = ({
children,
}) => {
const { authenticatedUser } = useContext(AuthContext);

Check warning on line 12 in frontend/src/components/auth/PrivateRoute.tsx

View workflow job for this annotation

GitHub Actions / run-lint

'authenticatedUser' is assigned a value but never used
return authenticatedUser ? (
return ( // after return, add "authenticatedUser ?""

Check warning on line 13 in frontend/src/components/auth/PrivateRoute.tsx

View workflow job for this annotation

GitHub Actions / run-lint

Insert `⏎···`
<Flex>
<SideBar />
{children}
</Flex>
) : (
<Navigate to={LOGIN_PAGE} />
);
// ) : (

Check warning on line 18 in frontend/src/components/auth/PrivateRoute.tsx

View workflow job for this annotation

GitHub Actions / run-lint

Insert `··`
// <Navigate to={LOGIN_PAGE} />

Check warning on line 19 in frontend/src/components/auth/PrivateRoute.tsx

View workflow job for this annotation

GitHub Actions / run-lint

Insert `··`
// );

Check warning on line 20 in frontend/src/components/auth/PrivateRoute.tsx

View workflow job for this annotation

GitHub Actions / run-lint

Insert `··`
)

Check warning on line 21 in frontend/src/components/auth/PrivateRoute.tsx

View workflow job for this annotation

GitHub Actions / run-lint

Insert `;`
};

export default PrivateRoute;
14 changes: 12 additions & 2 deletions frontend/src/components/common/SideBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ import { ReactComponent as Logo } from "../../assets/marillacPlaceLogo.svg";
import authAPIClient from "../../APIClients/AuthAPIClient";
import AuthContext from "../../contexts/AuthContext";

const mockAuthenticatedUser = {
id: "1",
type: "STAFF",
email: "janedoe@gmail.com",
firstName: "Jane",
lastName: "Doe",
};

const LOGOUT = gql`
mutation Logout($userId: ID!) {
logout(userId: $userId)
Expand All @@ -45,7 +53,9 @@ const SideBarTab: React.FC<{ label: string; handleClick: () => void }> = ({

const SideBar: React.FC = () => {
const navigate = useNavigate();
const { authenticatedUser, setAuthenticatedUser } = useContext(AuthContext);
// const { authenticatedUser, setAuthenticatedUser } = useContext(AuthContext);
const { setAuthenticatedUser } = useContext(AuthContext); // Temp
const authenticatedUser = mockAuthenticatedUser; // Temp
const [logout] = useMutation<{ logout: null }>(LOGOUT);

const onLogOutClick = async () => {
Expand All @@ -54,7 +64,7 @@ const SideBar: React.FC = () => {
logout,
);
if (success) {
setAuthenticatedUser(null);
setAuthenticatedUser(null);
}
};

Expand Down

0 comments on commit fb4c507

Please sign in to comment.