Super Sale Limited Time 50% OFF for All-Access Plans
Save 50% Now

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
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • 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
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(