Skip to content

Commit

Permalink
Refactor: remove the password-modal and logout on exit in dev mode
Browse files Browse the repository at this point in the history
  • Loading branch information
georgipavlov-7DIGIT committed Sep 19, 2024
1 parent 7d55457 commit c88a16d
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import "react-toastify/dist/ReactToastify.css";

import "./App.scss";

const IS_DEV = process.env.NODE_ENV === "development";

// Create a react-query client
const queryClient = new QueryClient({
defaultOptions: { queries: { refetchOnWindowFocus: false } },
Expand All @@ -32,13 +34,17 @@ function App() {
});

useEffect(() => {
window.addEventListener("beforeunload", (e) => {
if (!(performance.getEntriesByType("navigation")[0].type === "reload")) {
// If the page is being refreshed, do nothing
e.preventDefault();
adminSvc.logout();
}
});
if (!IS_DEV) {
window.addEventListener("beforeunload", (e) => {
if (
!(performance.getEntriesByType("navigation")[0].type === "reload")
) {
// If the page is being refreshed, do nothing
e.preventDefault();
adminSvc.logout();
}
});
}
}, []);

const getDefaultTheme = () => {
Expand Down

0 comments on commit c88a16d

Please sign in to comment.