<template>

<div></div>

</template>

<script lang='ts' setup>

import { getLoginForm, setLoginForm, removeLoginForm, setToken } from '@/utils/auth'
import { outFreeLogin } from '@/api/login'
import { useRouter, useRoute } from 'vue-router'

const router = useRouter()
const route = useRoute()

onBeforeMount(async () => {

  const { mobile } = route.query

  if (!mobile) {
    return router.push('login')
  }

  try {

    const res = await outFreeLogin({ mobile })

    setToken(res)
    router.push('/')
    
  } catch (error) {
    
    router.push('login')

  }
  

})


</script>