import { PropsWithChildren } from 'react'
import Taro, { useLaunch } from '@tarojs/taro'
import './app.scss'

function App({ children }: PropsWithChildren) {
  useLaunch(() => {
    const env = process.env.TARO_APP_CLOUD_ENV

    if (process.env.TARO_ENV === 'weapp' && env && Taro.cloud) {
      Taro.cloud.init({
        env,
        traceUser: true
      })
    }
  })

  return children
}

export default App

