完善认证功能,添加注销逻辑并优化用户界面

This commit is contained in:
2025-04-18 17:48:12 +08:00
parent 687c48c1b8
commit f5aeaf767d
5 changed files with 52 additions and 26 deletions

View File

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