import { fetchAllCustomers } from "@/app/api/customer";
import React from "react";
import CustomerSearch from "./CustomerSearch";
import CustomerSearchLoading from "./CustomerSearchLoading";

interface SubComponents {
  Loading: typeof CustomerSearchLoading;
}

const CustomerSearchWrapper: React.FC & SubComponents = async () => {
  const customers = await fetchAllCustomers();

  return <CustomerSearch customers={customers} />;
};

CustomerSearchWrapper.Loading = CustomerSearchLoading;

export default CustomerSearchWrapper;