Skip to content

Commit

Permalink
fix: close account message doesn't show up (binary-com#9210)
Browse files Browse the repository at this point in the history
Co-authored-by: niloofar sadeghi <niloofar.sadeghi@re-work.dev>
  • Loading branch information
niloofar-deriv and niloofar sadeghi committed Jul 4, 2023
1 parent 163a477 commit 7a3b458
Showing 1 changed file with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
import React from 'react';
import { useHistory } from 'react-router-dom';
import { Modal, Text } from '@deriv/components';
import { routes, getStaticUrl, PlatformContext } from '@deriv/shared';
import { Localize } from '@deriv/translations';
import { getStaticUrl, PlatformContext } from '@deriv/shared';
import { connect } from 'Stores/connect';
import { TCoreStore } from 'Stores/index';

const AccountClosed = ({ logout }) => {
type TAccountClosed = {
logout: () => void;
};

const AccountClosed = ({ logout }: TAccountClosed) => {
const [is_modal_open, setModalState] = React.useState(true);
const [timer, setTimer] = React.useState(10);
const { is_appstore } = React.useContext(PlatformContext);
const history = useHistory();

const counter = React.useCallback(() => {
if (timer > 0) {
Expand All @@ -20,7 +23,7 @@ const AccountClosed = ({ logout }) => {
}, [is_appstore, timer]);

React.useEffect(() => {
history.push(routes.root);
window.history.pushState(null, '', '/');
logout();
const handleInterval = setInterval(() => counter(), 1000);
return () => {
Expand All @@ -42,6 +45,6 @@ const AccountClosed = ({ logout }) => {
);
};

export default connect(({ client }) => ({
export default connect(({ client }: TCoreStore) => ({
logout: client.logout,
}))(AccountClosed);

0 comments on commit 7a3b458

Please sign in to comment.