This commit is contained in:
8
App.tsx
8
App.tsx
@@ -9,6 +9,7 @@ import { SignUpForm } from './components/auth/SignUpForm';
|
||||
import { EmailVerification } from './components/auth/EmailVerification';
|
||||
import { ForgotPassword } from './components/auth/ForgotPassword';
|
||||
import { ResetPassword } from './components/auth/ResetPassword';
|
||||
import { PrivacyPolicy } from './components/PrivacyPolicy';
|
||||
import { useSession, signOut } from './lib/auth-client';
|
||||
import { LayoutDashboard, Package, FileCheck, LogOut, UserCircle } from 'lucide-react';
|
||||
|
||||
@@ -26,6 +27,10 @@ type AppView =
|
||||
|
||||
type Tab = 'dashboard' | 'inventory' | 'protocol' | 'profile';
|
||||
|
||||
function isPrivacyRoute() {
|
||||
return window.location.pathname === '/privacy';
|
||||
}
|
||||
|
||||
function isResetPasswordRoute() {
|
||||
return (
|
||||
window.location.pathname === '/reset-password' &&
|
||||
@@ -35,6 +40,7 @@ function isResetPasswordRoute() {
|
||||
|
||||
export default function App() {
|
||||
const { data: session, isPending } = useSession();
|
||||
const [isPrivacy] = useState(isPrivacyRoute);
|
||||
const [view, setView] = useState<AppView>(
|
||||
isResetPasswordRoute() ? 'reset-password' : 'loading'
|
||||
);
|
||||
@@ -60,6 +66,8 @@ export default function App() {
|
||||
});
|
||||
}, [session, isPending, view]);
|
||||
|
||||
if (isPrivacy) return <PrivacyPolicy />;
|
||||
|
||||
if (view === 'reset-password') {
|
||||
return (
|
||||
<ResetPassword
|
||||
|
||||
Reference in New Issue
Block a user