import HeaderMenu from "../components/UI/HeaderMenu.tsx";
import {useEffect, useState} from "react";
import api from "../api.tsx";
import {LanguageEntity} from "../types/LanguageEntity.ts";
import {NoVocabularies} from "../components/NoVocabularies.tsx";

function Home() {
  const [languageEntity, setLanguageEntity] = useState<LanguageEntity[]>([]);
  useEffect(() => {
    api.get<LanguageEntity[]>('vocabulary').then((response) => {
      console.log(response.data);
      setLanguageEntity(response.data);
    })
  }, [])
  return <>
    <HeaderMenu />

    <div className={"container mx-auto"}>
      <h1 className="font-bold text-5xl">Welcome</h1>
      {languageEntity.length === 0 && <NoVocabularies />}
    </div>

  </>
}

export default Home;