"use client";
import { usePathname, useRouter } from "next/navigation";
import RcPagination from "rc-pagination";
import "rc-pagination/assets/index.css";

const Paginate = ({ pageInfo }) => {

  const router = useRouter()
  const pathname = usePathname()
  const onChange = (page) => {
    router.push(pathname + `?page=${page}`);
  }

  return <RcPagination onChange={onChange} current={pageInfo.page} total={pageInfo.total} pageSize={pageInfo.pageSize} />;
};

export default Paginate;
