✨ feat(user): Add user Detail
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
'use client';
|
||||
|
||||
import { ProTable } from '@/components/pro-table';
|
||||
import { getUserLoginLogs } from '@/services/admin/user';
|
||||
import { Badge } from '@workspace/ui/components/badge';
|
||||
import { formatDate } from '@workspace/ui/utils';
|
||||
import { useTranslations } from 'next-intl';
|
||||
import { useParams } from 'next/navigation';
|
||||
@@ -10,17 +12,19 @@ export default function UserLoginHistory() {
|
||||
const { id } = useParams<{ id: string }>();
|
||||
|
||||
return (
|
||||
<ProTable<
|
||||
{
|
||||
ip: string;
|
||||
user_agent: string;
|
||||
created_at: string;
|
||||
},
|
||||
Record<string, unknown>
|
||||
>
|
||||
<ProTable<API.UserLoginLog, Record<string, unknown>>
|
||||
columns={[
|
||||
{
|
||||
accessorKey: 'ip',
|
||||
accessorKey: 'success',
|
||||
header: t('loginStatus'),
|
||||
cell: ({ row }) => (
|
||||
<Badge variant={row.getValue('success') ? 'default' : 'destructive'}>
|
||||
{row.getValue('success') ? t('success') : t('failed')}
|
||||
</Badge>
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorKey: 'login_ip',
|
||||
header: t('loginIp'),
|
||||
},
|
||||
{
|
||||
@@ -33,16 +37,15 @@ export default function UserLoginHistory() {
|
||||
cell: ({ row }) => formatDate(row.getValue('created_at')),
|
||||
},
|
||||
]}
|
||||
params={[
|
||||
{
|
||||
key: 'search',
|
||||
placeholder: t('searchIp'),
|
||||
},
|
||||
]}
|
||||
request={async (pagination, filter) => {
|
||||
const { data } = await getUserLoginLogs({
|
||||
user_id: Number(id),
|
||||
...pagination,
|
||||
...filter,
|
||||
});
|
||||
return {
|
||||
list: [],
|
||||
total: 0,
|
||||
list: data.data?.list || [],
|
||||
total: data.data?.total || 0,
|
||||
};
|
||||
}}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user