Skip to content

Commit

Permalink
back from user page with escp
Browse files Browse the repository at this point in the history
  • Loading branch information
jschiel committed Feb 12, 2024
1 parent f2aa286 commit 355d49f
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions frontend/src/Components/User/Details/Details.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { useDispatch, useSelector } from 'react-redux';
import { CommonReducerType } from '../../../Reducer/CommonReducer';
import { dateToString, doGetRequest, doPostRequest, getmemberIDCookie, timeToString } from '../../Common/StaticFunctions';
import { openErrorToast, openToast, setDrinkCategories, setDrinks, setFavorites, setHistory, setMembers } from '../../../Actions/CommonAction';
import { useParams } from 'react-router-dom'
import { useNavigate, useParams } from 'react-router-dom'
import Cookies from 'js-cookie'
import { RootState } from '../../../Reducer/reducerCombiner'
import { Delete } from '@mui/icons-material'
Expand All @@ -25,6 +25,7 @@ const Details = (props: Props) => {

const params = useParams()
const dispatch = useDispatch()
const navigate=useNavigate()
const common: CommonReducerType = useSelector((state: RootState) => state.common);
const [searchField, setsearchField] = useState("")
const [dialogOpen, setdialogOpen] = useState(false)
Expand Down Expand Up @@ -246,14 +247,22 @@ const Details = (props: Props) => {
</TableContainer>
</div >

const checkUser = () => {
return parseInt(Cookies.get("memberID") as string)
}

return (
<>
<TransferDialog
isOpen={dialogOpen}
close={() => setdialogOpen(false)}
member={currentMember}
/>
<div className={style.details}>
<div className={style.details} onKeyUp={(event) => {
if (event.key === "Escape") {
navigate(checkUser() !== 1 && checkUser() !== 2 ? "/user/" + checkUser() : "/")
}
}}>
<div className={style.balanceContainer}>
{balancePaper()}
{window.innerWidth > mobileHistroyThreshold ? extraFunctions() : <></>}
Expand Down

0 comments on commit 355d49f

Please sign in to comment.