Newer
Older
RxFlux / app / src / main / java / j4ckall / rxflux / ui / registration / RegistrationActionCreater.java
package j4ckall.rxflux.ui.registration;

import io.reactivex.schedulers.Schedulers;
import j4ckall.rxflux.App;
import j4ckall.rxflux.lib.flux.ActionCreater;
import j4ckall.rxflux.repository.RegistrationRepository;


public class RegistrationActionCreater extends ActionCreater {
    private final RegistrationRepository registrationRepository;

    public RegistrationActionCreater() {
        super();
        this.registrationRepository = App.getRegistrationRepository();
    }

    public void registration(String userName) {
        registrationRepository.registration(userName).subscribeOn(Schedulers.computation()).subscribe(account -> {
            dispatch(RegistrationAction.REGISTRATION, account);
        });
    }
}