diff --git a/src/components/SettingsPage/CleanButton.js b/src/components/SettingsPage/CleanButton.js index 629c551f..f6d0ae94 100644 --- a/src/components/SettingsPage/CleanButton.js +++ b/src/components/SettingsPage/CleanButton.js @@ -8,6 +8,7 @@ import { cleanAccountsCache } from 'actions/accounts' import Button from 'components/base/Button' import { ConfirmModal } from 'components/base/Modal' import { softReset } from 'helpers/reset' +import ResetFallbackModal from './ResetFallbackModal' const mapDispatchToProps = { cleanAccountsCache, @@ -20,32 +21,35 @@ type Props = { type State = { opened: boolean, + fallbackOpened: boolean, isLoading: boolean, } class CleanButton extends PureComponent { state = { opened: false, + fallbackOpened: false, isLoading: false, } open = () => this.setState({ opened: true }) close = () => this.setState({ opened: false }) + closeFallback = () => this.setState({ fallbackOpened: false }) action = async () => { if (this.state.isLoading) return try { this.setState({ isLoading: true }) await softReset({ cleanAccountsCache: this.props.cleanAccountsCache }) - } finally { - this.setState({ isLoading: false }) + } catch (err) { + this.setState({ isLoading: false, fallbackOpened: true }) } } render() { const { t } = this.props - const { opened, isLoading } = this.state + const { opened, isLoading, fallbackOpened } = this.state return (