import { useEffect, useState } from 'react'
import { login } from '@/services/auth.service'
import { mockProfile } from '@/services/mock'
import type { UserProfile } from '@/types/domain'

export function useSession() {
  const [user, setUser] = useState<UserProfile>(mockProfile)

  useEffect(() => {
    login().then(result => setUser(result.user))
  }, [])

  return { user, setUser }
}

