Skip to content

Commit

Permalink
fix(settings): closing modal could close app
Browse files Browse the repository at this point in the history
  • Loading branch information
plebeius-eth committed Sep 6, 2024
1 parent ee7a349 commit b8fc7fb
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/components/settings-modal/settings-modal.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useState } from 'react';
import { useNavigate } from 'react-router-dom';
import { useLocation, useNavigate } from 'react-router-dom';
import { useTranslation } from 'react-i18next';
import styles from './settings-modal.module.css';
import AccountSettings from './account-settings';
Expand All @@ -12,10 +12,12 @@ import PlebbitOptions from './plebbit-options';

const SettingsModal = () => {
const { t } = useTranslation();
const location = useLocation();
const navigate = useNavigate();

const closeModal = () => {
navigate(-1);
const newPath = location.pathname.replace(/\/settings$/, '');
navigate(newPath);
};

const [showInterfaceSettings, setShowInterfaceSettings] = useState(false);
Expand Down

0 comments on commit b8fc7fb

Please sign in to comment.