import { useLoginStore } from '@/store/login'
import { useTabbar } from '@/store/tabbar'

export default async function useLogiutFn() {
  const loginStore = useLoginStore()
  const tabbarStore = useTabbar()
  if (loginStore.accessToken) {
    await loginStore.logoutFn()
  }
  loginStore.$reset()
  tabbarStore.$reset()
  setTimeout(() => {
    uni.reLaunch({
      url: '/pages/login/index'
    })
  }, 500)
}
