import { ReactNode } from 'react';
import { Navigate } from 'react-router-dom';
import { useStronghold } from '@stores/stronghold';
import { useAccount } from '@utils/hooks/useAccount';
export function Protected({ children }: { children: ReactNode }) {
const password = useStronghold((state) => state.password);
const { status, account } = useAccount();
if (status === 'success' && !account) {
return ;
}
if (status === 'success' && account && account.privkey.length > 35) {
return ;
}
if (status === 'success' && account && !password) {
return ;
}
return children;
}