import { PropsWithChildren } from 'react'
import { useLaunch } from '@tarojs/taro'
import { login } from './utils/request'
import './app.scss'

function App({ children }: PropsWithChildren<any>) {

  useLaunch(() => {
    console.log('App launched.')
    // Auto login
    login().then(res => {
        console.log('Logged in as:', res?.nickname)
    }).catch(err => {
        console.log('Auto login failed', err)
    })
  })

  return children
}

export default App
