"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.saga = saga;

var _typedReduxSaga = require("typed-redux-saga");

var _utils = require("../../utils");

var _slice = require("./slice");

function* initSaga(action) {
  var {
    initLodesSuccessAction,
    initLodesFailureAction
  } = _slice.lodeActions;

  try {
    var lode = yield* (0, _typedReduxSaga.call)(_utils.getLoded, action.payload.examplesLodeUrl, action.payload.declarationsLodeUrl);
    yield* (0, _typedReduxSaga.put)(initLodesSuccessAction(lode));
  } catch (error) {
    yield* (0, _typedReduxSaga.put)(initLodesFailureAction(error));
  }
}

function* saga() {
  var {
    initLodesAction
  } = _slice.lodeActions;
  yield* (0, _typedReduxSaga.takeEvery)(initLodesAction, initSaga);
}
//# sourceMappingURL=sagas.js.map