mirror of
https://github.com/ichsankurnia/hats-app.git
synced 2026-12-05 10:46:29 +00:00
34 lines
1.1 KiB
TypeScript
34 lines
1.1 KiB
TypeScript
'use client'
|
|
|
|
import { FC, Suspense, lazy, useState } from 'react';
|
|
import { Button } from '@/components/ui/button';
|
|
import { Dialog, DialogTrigger } from '@/components/ui/dialog';
|
|
import LazyLoading from '@/components/loader/LazyLoading';
|
|
import { type IUser } from '@/app/admin/administration/user/component/type';
|
|
|
|
const FormChangePassword = lazy(() => import('@/app/admin/administration/user/component/FormChangePassword'))
|
|
|
|
type Props = {
|
|
data?: IUser
|
|
};
|
|
|
|
const ChangePassword: FC<Props> = ({ data }) => {
|
|
const [showFormChangePass, setShowFormChangePass] = useState(false)
|
|
|
|
return (
|
|
<>
|
|
<Dialog open={showFormChangePass} onOpenChange={(state) => {
|
|
setShowFormChangePass(state)
|
|
}}>
|
|
<DialogTrigger asChild>
|
|
<Button>Change password</Button>
|
|
</DialogTrigger>
|
|
<Suspense fallback={<LazyLoading />}>
|
|
<FormChangePassword data={data} onCancel={() => setShowFormChangePass(false)} />
|
|
</Suspense>
|
|
</Dialog>
|
|
</>
|
|
);
|
|
}
|
|
|
|
export default ChangePassword; |