'use client';

import { useRouter } from 'next/navigation';
import { env } from '@/env';
import { RefreshRouteOnSave as PayloadRefreshRouteOnSave } from '@payloadcms/live-preview-react';

export const RefreshRouteOnSave = () => {
  const router = useRouter();

  return (
    <PayloadRefreshRouteOnSave
      refresh={() => router.refresh()}
      serverURL={env.NEXT_PUBLIC_SITE_URL}
    />
  );
};
