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

export 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});
  }
}

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

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