import { useLocation, useParams } from "react-router-dom";
import React from "react";
import { useGetAllTerm } from "../../../api/term";
import DataTable from "../../../Layout/Dashboard/Table/DataTable";
import { useColumns } from "./useTableColumns";
import useSearchQuery from "../../../api/utils/useSearchQuery";
import { ParamsEnum } from "../../../enums/params";

const App: React.FC = () => {
  const [searchQuery] = useSearchQuery("name");
  const { cycle_id } = useParams<ParamsEnum>();

  const response = useGetAllTerm({
    name: searchQuery,
    pagination: true,
    cycle_id: cycle_id,
  });

  return <DataTable response={response} useColumns={useColumns} />;
};

export default App;
