Files
external-app/app/page.tsx
2026-07-14 15:21:28 +08:00

22 lines
654 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { cookies } from 'next/headers'
import DashboardPage from './DashboardPage'
export default async function Home() {
const cookieStore = await cookies()
// 登录态以 token 为准:后端 access_token 接口只返回 token不含用户信息
// 拿到 access_token 即算登录成功user 信息可选(后端暂未提供 userinfo
const token = cookieStore.get('token')?.value
const userCookie = cookieStore.get('user')?.value
let user = null
if (userCookie) {
try {
user = JSON.parse(userCookie)
} catch {
// ignore
}
}
return <DashboardPage user={user} authenticated={!!token} />
}