import React, { useEffect } from 'react';
import { Page } from '../Page';
import { WelcomeContent } from './WelcomeContent';
import { useUserProfile } from '../../gql/queries/profile';
import { useHistory } from 'react-router';
import { useLoggedIn } from '../../hooks/useLoggedIn';

export function HomePage() {
  const loggedIn = useLoggedIn();
  const history = useHistory();

  useEffect(() => {
    if (loggedIn) history.push('/dashboard');
  }, [loggedIn])

  return (
    <Page title="Accueil">
      <WelcomeContent />
    </Page>
  );
}

export default HomePage;