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>
  )
}
