Files
web/src/app/admin/_server/profile.tsx

20 lines
558 B
TypeScript
Raw Normal View History

import {cookies} from 'next/headers'
import {Button} from '@/components/ui/button'
import {logout} from '@/actions/auth/auth'
export type ProfileProps = {}
export default async function Profile(props: ProfileProps) {
const store = await cookies()
const info = store.get('auth_info')?.value
const data = info ? JSON.parse(info) : undefined
return (
<div className="flex gap-2 items-center">
<span>{data?.payload.name}</span>
<Button theme={`error`} onClick={logout}>
退
</Button>
</div>
)
}