like when i made any auth system , user registers and then logins , then a cookie is generated , now like to have the user state stored across the app , i use redux , and also on refreshing the state should be there i use redux persist, no problem till that , but like if the cookie is 1d (its expiry) , but the redux persist is stored permantly ,
also i have never seen in any production level app that the data is stored in persist , so how do they deal with of thing of persist and the expiry as cookie experies , so the user should see login but it see some data though the persist
So how is the system of auth work (tell me the best solution)
i used persist and the cookie gets expired so it should show me login , but it shows all the features as the frontend checks user data from persist
here is a sample code of my frontend auth
import { useSelector } from "react-redux";
import { Outlet, Navigate } from "react-router-dom";
const ProtectedRoutes = () => {
const user = useSelector((state) => state.user.user);
return user ? <Outlet /> : <Navigate to="/" />;
};
export default ProtectedRoutes;
getting the user from the redux persist