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

27 lines
686 B
TypeScript
Raw Normal View History

'use client'
import {Button} from '@/components/ui/button'
import {logout} from '@/actions/auth'
import {useProfileStore} from '@/components/providers/StoreProvider'
import {useRouter} from 'next/navigation'
import {toast} from 'sonner'
export type ProfileProps = {}
export default function Profile(props: ProfileProps) {
const refreshProfile = useProfileStore(store => store.refreshProfile)
const doLogout = async () => {
2025-04-28 17:41:54 +08:00
const resp = await logout()
if (resp.success) {
await refreshProfile()
}
}
return (
<div className="flex gap-2 items-center">
<Button theme={`error`} onClick={doLogout}>
退
</Button>
</div>
)
}