got account deletion working
This commit is contained in:
parent
315ffb61ac
commit
218aeb31da
@ -1,5 +1,5 @@
|
|||||||
import { useRef, useState } from "react";
|
import { useRef, useState } from "react";
|
||||||
import { useFetcher, useSubmit, useTransition } from "@remix-run/react";
|
import { Form, useTransition } from "@remix-run/react";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
|
|
||||||
import Button from "../button";
|
import Button from "../button";
|
||||||
@ -12,9 +12,6 @@ export default function DangerZone() {
|
|||||||
const isDeletingUser = isCurrentFormTransition && transition.state === "submitting";
|
const isDeletingUser = isCurrentFormTransition && transition.state === "submitting";
|
||||||
const [isConfirmationModalOpen, setIsConfirmationModalOpen] = useState(false);
|
const [isConfirmationModalOpen, setIsConfirmationModalOpen] = useState(false);
|
||||||
const modalCancelButtonRef = useRef<HTMLButtonElement>(null);
|
const modalCancelButtonRef = useRef<HTMLButtonElement>(null);
|
||||||
const fetcher = useFetcher();
|
|
||||||
const submit = useSubmit();
|
|
||||||
// TODO
|
|
||||||
|
|
||||||
const closeModal = () => {
|
const closeModal = () => {
|
||||||
if (isDeletingUser) {
|
if (isDeletingUser) {
|
||||||
@ -56,8 +53,9 @@ export default function DangerZone() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="mt-5 md:mt-4 md:flex md:flex-row-reverse">
|
<div className="mt-5 md:mt-4 md:flex md:flex-row-reverse">
|
||||||
|
<Form method="post">
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="submit"
|
||||||
className={clsx(
|
className={clsx(
|
||||||
"transition-colors duration-150 w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 text-base font-medium text-white focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 md:ml-3 md:w-auto md:text-sm",
|
"transition-colors duration-150 w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 text-base font-medium text-white focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 md:ml-3 md:w-auto md:text-sm",
|
||||||
{
|
{
|
||||||
@ -69,6 +67,8 @@ export default function DangerZone() {
|
|||||||
>
|
>
|
||||||
Delete my account
|
Delete my account
|
||||||
</button>
|
</button>
|
||||||
|
<input type="hidden" name="_action" value="deleteUser" />
|
||||||
|
</Form>
|
||||||
<button
|
<button
|
||||||
ref={modalCancelButtonRef}
|
ref={modalCancelButtonRef}
|
||||||
type="button"
|
type="button"
|
||||||
|
Loading…
Reference in New Issue
Block a user