root.js 516 Bytes
import { call, put, takeEvery } from 'redux-saga/effects'
import axios from 'axios'

function* getHeader() {
  try {
    const response = yield call(axios.get, '/regional_design/repos.json');
    yield put({type: "HEADER_FETCH_SUCCEEDED", headers: response.data});
  } catch (e) {
    yield put({type: "HEADER_FETCH_FAILED", message: e.message});
  }
}

function* watchGetHeader() {
  yield takeEvery("HEADER_FETCH_REQUESTED", getHeader)
}

export default function* rootSaga() {
  yield [
    watchGetHeader()
  ]
}