// import 'default-passive-events';

import App from './App'
import store from './store/index'

import { Provider } from 'react-redux'
import { createRoot } from 'react-dom/client'

import { ConfigProvider } from 'antd'

// 兼容360浏览器
import { StyleProvider, legacyLogicalPropertiesTransformer } from '@ant-design/cssinjs'

import 'dayjs/locale/zh-cn'
import locale from 'antd/locale/zh_CN'
import { API_getLike } from './store/action/all'

const container = document.getElementById('root') as HTMLElement
const root = createRoot(container)

// 获取点赞数量
const getLikeFu = async () => {
  const res = await API_getLike()
  if (res.code === 0) {
    store.dispatch({ type: 'layout/likeNum', payload: res.data.pcsStar || 0 })
  }
}
getLikeFu()

root.render(
  <ConfigProvider
    locale={locale}
    theme={{
      token: {
        colorPrimary: '#ead98f'
      }
    }}
  >
    <Provider store={store}>
      <StyleProvider hashPriority='high' transformers={[legacyLogicalPropertiesTransformer]}>
        <App />
      </StyleProvider>
    </Provider>
  </ConfigProvider>
)
