Sanji redux helper service is part of Sanji UI framework and also it is a angular module. It is just a ng-redux wrapper and help configure the application store.
Sanji redux helper is based on es6 + webpack to development and embrace npm to install it.
npm install sanji-redux-ui --save
const category = (state = {}, {type, payload}) => {
switch (type) {
case 'GET_CURRENT_CATEGORY':
return payload || { name: undefined };
default:
return state;
}
};
angular.module('webapp', ['sanji.redux'])
.config(reduxHelperProvider => {
'ngInject';
reduxHelperProvider.configure({
category
});
})
.run((reduxHelper) => {
'ngInject';
const test = (state = [], {type, payload}) => {
switch (type) {
case 'GET_CATEGORIES':
return payload || state;
default:
return state;
}
};
// Dynamically inject reducer
reduxHelper.injectAsyncReducer('test', test);
});
reduxHelperProvider.configure({
category
}, window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__());
Author: Zack Yang © 2016
Support: if you find any problems with this library, open issue on Github