import { Block } from "@styled-icons/boxicons-regular"; import { Trash } from "@styled-icons/boxicons-solid"; import { Text } from "preact-i18n"; import { useContext } from "preact/hooks"; import { CategoryButton } from "@revoltchat/ui"; import { modalController } from "../../../context/modals"; import { LogOutContext, useClient, } from "../../../context/revoltjs/RevoltClient"; export default function AccountManagement() { const logOut = useContext(LogOutContext); const client = useClient(); const callback = (route: "disable" | "delete") => () => modalController.mfaFlow(client).then( (ticket) => ticket && client.api .post(`/auth/account/${route}`, undefined, { headers: { "X-MFA-Ticket": ticket.token, }, }) .then(() => logOut(true)), ); return ( <>