import { createRoot } from 'react-dom/client'
import { getGlobalConfig } from '../utils/utils'
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
import { AuthProvider } from './hooks/AuthProvider'
import { RouterProvider } from 'react-router-dom'
import { router } from './routes'

// 创建QueryClient实例
const queryClient = new QueryClient();

// 应用入口组件
const App = () => {
  return (
    <QueryClientProvider client={queryClient}>
      <AuthProvider>
        <RouterProvider router={router} />
      </AuthProvider>
    </QueryClientProvider>
  )
};

const rootElement = document.getElementById('root')
if (rootElement) {
  const root = createRoot(rootElement)
  root.render(
    <App />
  )
}