{"size": 514, "ext": "js", "max_stars_repo_path": "src/sagas/Login.js", "max_stars_repo_name": "chenlizan/react-boilerplate", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/sagas/Login.js", "max_issues_repo_name": "chenlizan/react-boilerplate", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/sagas/Login.js", "max_forks_repo_name": "chenlizan/react-boilerplate", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 24.4761904762, "max_line_length": 74, "alphanum_fraction": 0.7042801556}
/**
 * Created by chenlizan on 2018/5/4.
 */

import { call, delay, put, takeEvery } from "redux-saga/effects";
import { login_succeeded_creator, login_failed_creator } from "../action";

function* loginProcess(action) {
  try {
    yield delay(2000);
    yield put(login_succeeded_creator("Login successful"));
    yield put(login_succeeded_creator(null));
  } catch (e) {
    yield put(login_failed_creator(e.message));
  }
}

export function* loginSaga() {
  yield takeEvery("LOGIN_REQUESTED", loginProcess);
}
