<script setup lang="ts">
import { onMounted } from 'vue'
import { useRoute, useRouter } from 'vue-router'

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

onMounted(() => {
  const token = route.params.token as string
  if (token) {
    localStorage.setItem('Authorization', token)
  }
  router.replace('/user-center')
})
</script>

<template>
  <div class="login-redirect">
    <!-- Optional: Adding a loading state for visibility during transition -->
    <div class="loading-spinner">登录中...</div>
  </div>
</template>

<style scoped>
.login-redirect {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  font-size: 1.2rem;
  color: #666;
}
</style>
