Mark
Mark

Reputation: 171

How reload data after logout in angular 7?

I recently met with Angular what to understand all the subtleties of his work. So, I faced the problem that after logging out of the account and authorization in another account, the data is displayed by the previous user. Only after reloading the page the correct data is displayed. How to update data without reloading the page. I found the answers, but they either do not work, or are too confusing and incomprehensible.

Upvotes: 0

Views: 1131

Answers (2)

Monday A Victor
Monday A Victor

Reputation: 471

Let me assume you are using a service to move the data across the components, to let angular know that something has changed since it doesn't reload a page, you can use Observers to emit the data and reset the variable holding it on logout that way you would have solved the problem you have now

Upvotes: 0

Kamil Kiełczewski
Kamil Kiełczewski

Reputation: 92467

Detect where angular app store login data (cookie or some global app state variable? probably not local-storage because reload helps...) and then clean that data on logout

Upvotes: 2

Related Questions