1

I have a simple _clear function in my AuthActions file which sets this.data to undefined. I am calling this function only when a user logs out. When I log back in with a different user, the data from the previous account is still hanging out in several Stores. What is the best way to clear all data from each Store when the _clear function is called?

Jeremy Sullivan
  • 995
  • 1
  • 14
  • 25

1 Answers1

1

In Flux applications, views fire Actions, which anyone in the application can subscribe to. Usually, Stores listen to actions to perform any logic.

This approach means that your Store fires Actions::logoutAuth and other Stores listen to this Action. You should define clear logic in every one of Stores. Because Stores has different states and business logic.

Also, Actions shouldn't have any logic. The Action is a label for pub/sub flow.

Yura Zatsepin
  • 716
  • 7
  • 7