kumabook/spread_beaver_frontend

View on GitHub
lib/sagas/flash.js

Summary

Maintainability
A
0 mins
Test Coverage
import { delay } from 'redux-saga';
import { put, takeEvery } from 'redux-saga/effects';

export function* notice({ payload: { message, duration } }) {
  yield put({ type: 'flash:notice:show', payload: message });
  yield delay(duration);
  yield put({ type: 'flash:notice:hide' });
}

export function* watchFlash() {
  yield takeEvery('flash:notice', notice);
}