@voidwalkers/void-redux
v0.1.45
Published
Redux-based client lib for Void Walkers Void
Downloads
9
Readme
Redux-based client lib for Void Walkers Void
import VoidRedux from '@voidwalkers/void-redux';
import {takeLatest} from 'redux-saga/effects';
const voidRedux = new VoidRedux({
createDucks(create) {
return [
create({
apiWrapperOptions: {
collectionName: 'items'
},
name: 'items'
})
];
},
createSagas(ducks) {
return [
function * items() {
yield takeLatest(ducks.items.actions.read.actionType.success, function * ({payload}) {
console.log(payload.response.data); // Example output: '{"items": [{"_id": "..."}]}'
});
}
];
},
project: {
slug: 'slug',
tokenPublic: 'token'
}
});
voidRedux.store.dispatch(voidRedux.ducks.items.actions.read());