Browse Source
Merge pull request #94 from vernu/refactor-delete-account
refactor delete account component
pull/95/head
Israel Abebe
9 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with
8 additions and
3 deletions
-
web/app/(app)/dashboard/(components)/delete-account-form.tsx
-
web/app/(app)/dashboard/account/delete-account/page.tsx
|
|
|
@ -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() |
|
|
|
} |
|
|
|
@ -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> |
|
|
|
|