import React from 'react';
import { useSearchParams } from 'react-router-dom';
import OrderView from './components/order-view';
import ReturnMainTable from './components/order-daily-overview';

const OrderViewQueryHandler = () => {
  const [searchParams] = useSearchParams(); // Access the query params
  const orderId = searchParams.get('order'); // Get the 'order' param

  // If 'order' query param is present, render OrderViewWrapper, otherwise redirect to home
  return orderId ? <OrderView /> : <ReturnMainTable />;
};

export default OrderViewQueryHandler;
