Greetings. When I change the theme mode in my Angular Metronic v8.1.5 project, it logs out of the application and switches to the login screen. When I look at the source of this, there is a line "document.location.reload()" in the "switchMode" function in the theme-mode.service.ts file. I think it is caused by this, but when I remove that line, it does not change the theme mode. Can you help me what to do?
public switchMode(_mode: ThemeModeType) {
if (localStorage) {
const updatedMode = _mode === "system" ? systemMode : _mode;
localStorage.setItem(themeModeLSKey, updatedMode);
localStorage.setItem(themeMenuModeLSKey, _mode);
}
document.location.reload()
}
Hi,
Reloading the page is typically required to apply the updated theme styles. However, it should not log you out by default.
By design, reloading the page does not log users out of the application. This behavior suggests that there might be something else in your project configuration or authentication logic that is causing the logout when the page is reloaded.
Have you customise the auth behaviour or by default?
Thanks