import Orders from './orders';
import {useOrdersData} from '../../hooks/order';
import Loader from '../shared/loader';
import Error from '../shared/error';

function OrdersContainer() {
  const {isLoading, isError, data, error} = useOrdersData();

  if (isLoading) return <Loader />;
  if (isError) return <Error error={error} />;
  return <Orders orderItems={data} />;
}

export default OrdersContainer;
