diff --git a/packages/app/components/profile/AccountDeleted.story.tsx b/packages/app/components/profile/AccountDeleted.story.tsx index 60b72e9..26bfcfa 100644 --- a/packages/app/components/profile/AccountDeleted.story.tsx +++ b/packages/app/components/profile/AccountDeleted.story.tsx @@ -8,6 +8,13 @@ import AccountDeleted from './AccountDeleted'; storiesOf('Components/Profile', module).add('AccountDeleted', () => ( - + + new Promise((resolve) => { + action('onRestore')(); + setTimeout(resolve, 500); + }) + } + /> )); diff --git a/packages/app/components/profile/AccountDeleted.tsx b/packages/app/components/profile/AccountDeleted.tsx index 495a74b..fe7d4be 100644 --- a/packages/app/components/profile/AccountDeleted.tsx +++ b/packages/app/components/profile/AccountDeleted.tsx @@ -1,4 +1,4 @@ -import React, { ComponentType } from 'react'; +import React, { ComponentType, useCallback, useState } from 'react'; import { FormattedMessage as Message } from 'react-intl'; import { Helmet } from 'react-helmet-async'; @@ -7,10 +7,20 @@ import { Button } from 'app/components/ui/form'; import styles from './accountDeleted.scss'; interface Props { - onRestore?: () => void; + onRestore?: () => Promise; } const AccountDeleted: ComponentType = ({ onRestore }) => { + const [isSubmitted, setIsSubmitted] = useState(false); + const onRestoreClick = useCallback(() => { + if (!onRestore) { + return; + } + + setIsSubmitted(true); + onRestore().finally(() => setIsSubmitted(false)); + }, [onRestore]); + return (
@@ -36,7 +46,7 @@ const AccountDeleted: ComponentType = ({ onRestore }) => { />
-