refactor(web): refactor delete account component

This commit is contained in:
isra el
2025-06-11 11:49:41 +03:00
parent 60bcd691c8
commit 54fb586d9b
2 changed files with 8 additions and 3 deletions

View File

@@ -19,7 +19,7 @@ import {
DialogTitle,
} from '@/components/ui/dialog'
export default function DangerZoneForm() {
export default function DeleteAccountForm() {
const [isDeleteDialogOpen, setIsDeleteDialogOpen] = useState(false)
const [deleteConfirmEmail, setDeleteConfirmEmail] = useState('')
const [deleteReason, setDeleteReason] = useState('')
@@ -39,6 +39,11 @@ export default function DangerZoneForm() {
title: 'Please enter your correct email address',
})
return
} else if (deleteReason.length < 4) {
toast({
title: 'Please enter a reason for deletion',
})
return
}
requestAccountDeletion()
}

View File

@@ -1,6 +1,6 @@
import { AlertTriangleIcon } from 'lucide-react'
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'
import DangerZoneForm from '../../(components)/danger-zone-form'
import DeleteAccountForm from '../../(components)/delete-account-form'
export default function DangerZonePage() {
return (
@@ -25,7 +25,7 @@ export default function DangerZonePage() {
</CardDescription>
</CardHeader>
<CardContent>
<DangerZoneForm />
<DeleteAccountForm />
</CardContent>
</Card>
</div>