0

I am building a robotlegs app where you have to login in order to use it. When you loggin I have numerous mediators,injectors,models,vos etc. What should I remove when one logs out?

Thanks in advance.

chchrist
  • 18,854
  • 11
  • 48
  • 82

2 Answers2

1

This is tough to answer, since your question is kind of vague. Some more details as to the inner structure would be helpful. Depending on your situation, you may just need to remove any navigation elements that would let the user access content that would require them to be logged in. If your user is represented by a persistent object, you could also use an isLoggedIn flag that you would check when the user tries doing something that requires them to be logged in. Again, this is tough to answer because of the question's vagueness, but I don't think there's anything really specific to RobotLegs you need to do, it's more about application design.

Steven Mercatante
  • 24,757
  • 9
  • 65
  • 109
  • My problem is that when I logout my views are still mediated. I want when one logs out and then relogins the onRegister() to run all the events again. – chchrist Nov 30 '10 at 21:21
  • 1
    RobotLegs automatically mediates views. If you remove a view from the display list, and then later add it back, I think onRegister() will fire again. If it doesn't, you can listen for Event.ADDED_TO_STAGE and manually call onRegister() from within your listener method. – Steven Mercatante Nov 30 '10 at 21:31
1

There is a onRemove function in the mediator which works like onRegister, it should remove all the registered events in your mediator. Have a look, it may be what you're looking for.

Stephen

StephenAdams
  • 521
  • 2
  • 9
  • 26