Get 2024 Templates Mega Bundle!14 Bootstrap, Vue & React Templates + 3 Vector Sets
Get for 99$

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.


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()
}


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (1)


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


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(