sn-redux is a convention driven way of building Sense/Net applications using Redux. It contains all the action types, actions and reducers for built-in Sense/Net Actions and Functions.
sn-redux gives you a standard set of:
Get the latest stable version with npm
npm install --save sn-redux
or from the GitHub repository and place the downloaded source into your project. If you want to use only the transpiled JavaScript modules, you can find them in the dist/src folder and import them like
var SN = require('/pathtomodule/sn-redux');
If you want to use the module types you can find them in the src folder. Import them the following way:
import { Actions } from 'sn-redux';
store.dispatch(Actions.Delete(123, false));
To install the latest stable version
npm install --save sn-redux
Set your Sense/Net portal's url with SetSiteUrl method
import { SetSiteUrl } from 'sn-client-js';
SetSiteUrl('https://daily.demo.sensenet.com');
So that you can set the url of your Sense/Net portal that you want to communicate with. To enable your external app to send request against your Sense/Net portal change
your Portal.settings. For further information about cross-origin resource sharing in Sense/Net check this
article.
Check your Sense/Net portal's web.config and if the ODataServiceToken is set, use the SetServiceToken() method to set the same service token on client side.
import { SetServiceToken } from 'sn-client-js';
SetServiceToken('myservicetoken');
var Actions = require('sn-redux').Actions;
store.dispatch(Actions.Delete(123, false));
import { Actions } 'sn-redux';
store.dispatch(Actions.Delete(123, false));
Building the project, running all the unit tests and the ts linter and get the code coverage report, use:
gulp
To execute all unit tests, use:
gulp test
gulp test:coverage
import { combineReducers } from 'redux';
import { Reducers } from 'sn-redux';
const collection = Reducers.collection;
const myReducer = combineReducers({
collection,
listByFilter
});
import { Store } from 'sn-redux';
const store = Store.configureStore(myReducer);
import { Content } from 'sn-client-js';
import { Actions } from 'sn-redux';
const parentPath = '/workspaces/Project/budapestprojectworkspace/tasks';
const content = new Content({
Type: 'Task',
DisplayName: 'My first task'
});
dispatch(Actions.CreateContent(parentPath, content))
Generated using TypeDoc