// import { Link, routes } from '@redwoodjs/router'
import { Link } from '@redwoodjs/router'
import { Metadata } from '@redwoodjs/web'

import { useAuth } from 'src/auth'

const HomePage = () => {
  const user = useAuth()

  return (
    <>
      <Metadata title="Home" description="Home page" />

      <h1>HomePage</h1>
      <p>
        Find me in <code>./web/src/pages/HomePage/HomePage.tsx</code>
      </p>
      {/*
          My default route is named `home`, link to me with:
          `<Link to={routes.home()}>Home</Link>`
      */}
      {user && user.isAuthenticated + ' ' + user.hasRole('admin')}
      <Link to={'/login'}>Login</Link>
    </>
  )
}

export default HomePage
