import '../styles/globals.scss';
import type { AppProps } from 'next/app';
import { SWRConfig } from 'swr';
import fetchJson from '../lib/utils/swr-fetcher';
import ModalRoot from '../components/common/Modal/ModalRoot/ModalRoot';
import { Toaster } from 'react-hot-toast';

function MyApp({ Component, pageProps }: AppProps) {
  return (
    <SWRConfig
      value={{
        fetcher: fetchJson,
        onError: (err) => {
          console.error(err);
        },
      }}
    >
      <Toaster position="top-right" />
      <Component {...pageProps} />
      <ModalRoot />
    </SWRConfig>
  );
}

export default MyApp;
