mirror of
https://github.com/perfect-panel/ppanel-web.git
synced 2026-02-15 12:51:11 -05:00
39 lines
1.0 KiB
TypeScript
39 lines
1.0 KiB
TypeScript
'use client';
|
|
|
|
import { getUserDetail } from '@/services/admin/user';
|
|
import { useQuery } from '@tanstack/react-query';
|
|
import { useParams } from 'next/navigation';
|
|
import { AuthMethodsForm } from './auth-methods-form';
|
|
import { BasicInfoForm } from './basic-info-form';
|
|
import { NotifySettingsForm } from './notify-settings-form';
|
|
|
|
export function UserProfileForm() {
|
|
const { id } = useParams<{ id: string }>();
|
|
|
|
const { data: user, refetch } = useQuery({
|
|
queryKey: ['user', id],
|
|
queryFn: async () => {
|
|
const { data } = await getUserDetail({
|
|
id: Number(id),
|
|
});
|
|
return data.data;
|
|
},
|
|
});
|
|
|
|
if (!user) return null;
|
|
|
|
return (
|
|
<div className='grid gap-4 md:grid-cols-2 xl:grid-cols-3'>
|
|
<div className='md:col-span-2 xl:col-span-1'>
|
|
<BasicInfoForm user={user} refetch={refetch} />
|
|
</div>
|
|
<div>
|
|
<NotifySettingsForm user={user} refetch={refetch} />
|
|
</div>
|
|
<div>
|
|
<AuthMethodsForm user={user} refetch={refetch} />
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|