chore: udpate react, downshift and routing

This commit is contained in:
Rafael Taranto 2025-05-15 13:00:21 +01:00
parent 61285c9037
commit d9e570990c
30 changed files with 4131 additions and 2813 deletions

View file

@ -1,24 +1,17 @@
import React, { useContext } from 'react'
import { Route, Redirect } from 'react-router-dom'
import { Route, Redirect } from 'wouter'
import AppContext from '../AppContext'
import { isLoggedIn } from './utils'
const PublicRoute = ({ component: Component, restricted, ...rest }) => {
const PublicRoute = ({ restricted, ...rest }) => {
const { userData } = useContext(AppContext)
return (
<Route
{...rest}
render={props =>
isLoggedIn(userData) && restricted ? (
<Redirect to="/" />
) : (
<Component {...props} />
)
}
/>
return isLoggedIn(userData) && restricted ? (
<Redirect to="/" />
) : (
<Route {...rest} />
)
}