From 98e8c7b4b0abd1eef729e36cc124fdcb7b2779e2 Mon Sep 17 00:00:00 2001 From: uo289689 Date: Fri, 26 Apr 2024 21:39:21 +0200 Subject: [PATCH] Implemented redirecction to /login or /homepage in home --- webapp/src/pages/Home.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/webapp/src/pages/Home.js b/webapp/src/pages/Home.js index fcfa9336..9185ff76 100644 --- a/webapp/src/pages/Home.js +++ b/webapp/src/pages/Home.js @@ -2,10 +2,15 @@ import * as React from "react"; import {Box, Button} from "@mui/material"; import useMediaQuery from '@mui/material/useMediaQuery'; import { useTranslation } from 'react-i18next'; +import { SessionContext } from '../SessionContext'; +import { useContext } from 'react'; const Home = () => { const xxl = useMediaQuery('(min-width:1920px)'); const { t } = useTranslation(); + const {username} = useContext(SessionContext); + + const redirectPath = username ? "/login" : "/homepage"; const styles = { logo:{ @@ -97,7 +102,7 @@ const Home = () => { Logo - +