2017-01-26 18:53:52 +01:00
|
|
|
import { takeLatest } from 'redux-saga';
|
|
|
|
import { put } from 'redux-saga/effects';
|
|
|
|
|
|
|
|
import {
|
|
|
|
loadedRecord,
|
|
|
|
} from './actions';
|
|
|
|
|
|
|
|
import {
|
|
|
|
LOAD_RECORD,
|
|
|
|
} from './constants';
|
|
|
|
|
|
|
|
export function* getRecord() {
|
|
|
|
const fakeData = {
|
|
|
|
id: 1,
|
|
|
|
title: 'Roger Federer has won the first set.',
|
|
|
|
message: 'Try to do better than that man and you will be a winner.'
|
|
|
|
};
|
|
|
|
|
|
|
|
yield put(loadedRecord(fakeData));
|
|
|
|
}
|
2017-01-26 17:53:47 +01:00
|
|
|
|
|
|
|
// Individual exports for testing
|
|
|
|
export function* defaultSaga() {
|
2017-01-26 18:53:52 +01:00
|
|
|
yield takeLatest(LOAD_RECORD, getRecord);
|
2017-01-26 17:53:47 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// All sagas to be loaded
|
|
|
|
export default [
|
|
|
|
defaultSaga,
|
|
|
|
];
|