'use client';
import { useEffect } from 'react';

export function MSWProvider({ children }: { children: React.ReactNode }) {
  useEffect(() => {
    if (process.env.NEXT_PUBLIC_API_MOCKING === 'enabled') {
      const { worker } = require('../../mock/browser.ts');
      worker.start();
    }
  }, []);

  return <>{children}</>;
}
