import { useColumns } from ".";

import { useLocation } from "react-router-dom";
import React from "react";
import { useGetAllPayment } from "../../api/payment";
import DataTable from "../../Layout/Dashboard/Table/DataTable";
import { useObjectToEdit } from "../../zustand/ObjectToEditState";
import useSearchQuery from "../../api/utils/useSearchQuery";

const App: React.FC = () => {
  const { param_to_send } = useObjectToEdit();

  const [searchQuery] = useSearchQuery("q");
  const [type] = useSearchQuery("type");

  const response = useGetAllPayment({
    student_name: searchQuery,
    pagination: true,
    type: type,
    date: param_to_send?.date,
  });

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

export default App;
