// withHooks

import { LibCurl } from 'esoftplay/cache/lib/curl/import';
import { LibNavigation } from 'esoftplay/cache/lib/navigation/import';
import { UserClass } from 'esoftplay/cache/user/class/import';


export interface MarketUser_profileArgs {

}
export interface MarketUser_profileProps {

}


export function update(_callback?: () => void): void {
  new LibCurl('user?t=' + new Date().getTime(), null,
    (res) => {
      UserClass?.create(res)
      _callback?.()
    },
    (msg) => {

    }, 1
  )
}

export function isLogin(isLogin: () => void, isLogout?: () => void): void {
  let user = UserClass?.state()?.get()
  if (user && user?.id) {
    isLogin()
  } else {
    isLogout
      ? isLogout()
      : LibNavigation.navigate('user/login')
  }
}

export default function m(props: MarketUser_profileProps): any {
  return null
}