diff --git a/pages/_app.tsx b/pages/_app.tsx index c41c8148..6b0d3527 100644 --- a/pages/_app.tsx +++ b/pages/_app.tsx @@ -50,7 +50,7 @@ const Wrapper: React.FC = ({ children }) => { - {connected && renderGetters()} + {connected && !isRoot && renderGetters()}
diff --git a/src/views/settings/Danger.tsx b/src/views/settings/Danger.tsx index 2f055714..26455d0e 100644 --- a/src/views/settings/Danger.tsx +++ b/src/views/settings/Danger.tsx @@ -20,6 +20,7 @@ import { AlertCircle } from 'react-feather'; import { useStatusDispatch } from '../../context/StatusContext'; import { useRouter } from 'next/router'; import { appendBasePath } from '../../utils/basePath'; +import { useChatDispatch } from '../../context/ChatContext'; export const ButtonRow = styled.div` width: auto; @@ -76,6 +77,7 @@ export const DangerView = () => { } = useAccount(); const dispatch = useStatusDispatch(); + const chatDispatch = useChatDispatch(); const { push } = useRouter(); @@ -105,14 +107,7 @@ export const DangerView = () => { } if (accounts.length === 1) { return ( - { - deleteAccount(accounts[0].id); - refreshAccount(); - push(appendBasePath('/')); - }} - > + {accounts[0].name} ); @@ -120,9 +115,18 @@ export const DangerView = () => { return null; }; + const handleDeleteAll = () => { + dispatch({ type: 'disconnected' }); + chatDispatch({ type: 'disconnected' }); + deleteStorage(); + refreshAccount(); + push(appendBasePath('/')); + }; + const handleDelete = (admin?: boolean) => { deleteAccountPermissions(id, accounts, admin); dispatch({ type: 'disconnected' }); + chatDispatch({ type: 'disconnected' }); changeAccount(id); push(appendBasePath('/')); }; @@ -153,14 +157,7 @@ export const DangerView = () => { Delete all Accounts and Settings: - { - deleteStorage(); - refreshAccount(); - push(appendBasePath('/')); - }} - > + Delete All