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 e19e813 commit 0287057
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 @@ -16,6 +16,8 @@ import AOS from "aos";

import "./App.scss";

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

// Create a react-query client
const queryClient = new QueryClient({
defaultOptions: {
Expand All @@ -40,13 +42,17 @@ function App() {
i18n.changeLanguage(language);
}

window.addEventListener("beforeunload", (e) => {
if (!(performance.getEntriesByType("navigation")[0].type === "reload")) {
// If the page is being refreshed, do nothing
e.preventDefault();
userSvc.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();
userSvc.logout();
}
});
}
}, []);

const getDefaultTheme = () => {
Expand Down

0 comments on commit 0287057

Please sign in to comment.