Skip to content

Instantly share code, notes, and snippets.

View yushimatenjin's full-sized avatar

yushimatenjin

View GitHub Profile
@yushimatenjin
yushimatenjin / CategorySagas.js
Created January 6, 2019 11:23 — forked from pesakitan22/CategorySagas.js
Redux-Saga for next.js
import {call, put, take, fork} from 'redux-saga/effects'
import {END} from 'redux-saga'
import CategoryActions, {CategoryTypes} from '../Redux/CategoryRedux'
// attempts to fetch category
export function* fetchCategoryServer (api) {
let action = yield take(CategoryTypes.CATEGORY_SERVER)
// check when it stopped
while (action !== END) {
yield fork(fetchCategoryAPI, api)