1.3.3 • Published 3 years ago
tsor v1.3.3
TSOR
TypeScript + OData + Redux.
TSOR combines TypeScript, Redux, mongo-esque json queries & the SAP Cloud SDK for JS in one powerful library.
Install
Install from the NPM repository using yarn or npm:
yarn add tsor
npm install tsor
Usage
import { TSORSlice, TSORStore } from 'TSOR';
const businessPartnerSlice = new TSORSlice(BusinessPartner);
const productSlice = new TSORSlice(Product);
const { get: productGet } = productSlice.getActions();
const { selectAll: productSelectAll } = productSlice.getSelectors();
const settingsSlice = new TSORSettingsSlice({
headers: { Authorization: 'TOKEN' },
url: 'https://example.com',
});
const store = new TSORStore({
businessPartner: businessPartnerSlice,
product: productSlice,
settings: settingsSlice,
});
// Load Products from Backend
store.dispatch(productGet());
// Select All Products
const products = productSelectAll(store.getState());
You can find more usage examples in the tests.