Reactive State Machine with RxJs