diff -r 18fa4a1fa9e9 -r 6fd752d98933 client/src/sagas/groupSaga.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/client/src/sagas/groupSaga.js Tue Jun 27 18:12:10 2017 +0200 @@ -0,0 +1,21 @@ +import { put, take, all } from 'redux-saga/effects' +import * as types from '../constants/actionTypes'; + +function* watchCreateGroup(context) { + while (true) { + const { group } = yield take(types.GROUP_CREATE_ASYNC); + const client = context.client; + try { + const response = yield client.post('/api/auth/group/', group); + yield put({ type: types.GROUP_CREATE_SUCCESS, group: response }); + } catch (e) { + yield put({ type: types.GROUP_CREATE_ERROR, error: e }); + } + } +} + +export default function* rootSaga(context) { + yield all([ + watchCreateGroup(context), + ]) +}