Events

We could try it but there may be an error. We store the new user after our ajax call which updates the user. The event is triggered immediately after that line. This means that the event to retrieve the new user could occur before the new user has actually been stored in localStorage. We could discuss which is faster or we could trigger the event in the callback of storeCurrentUser().