import Loader from '../shared/loader';
import { useSettleRequests } from '../../hooks/react-query/use-settle-request';
import Error from '../shared/error';
import { APIErrorType } from '../../api';
import FinancialTab from './financial-tab';

function FinancialContainer() {
  const { isLoading, isError, error, isSuccess, data } = useSettleRequests();
  if (isLoading) return <Loader />;
  if (isError) return <Error error={error as APIErrorType} />;
  if (isSuccess) return <FinancialTab settleRequests={data} />;
  return null;
}

export default FinancialContainer;
