UNPKG

@drieam/common

Version:

Default Drieam api wrapper

81 lines (56 loc) 1.99 kB
--- menu: '@drieam/common' name: 'Getting Started' route: /common --- [![npm](https://img.shields.io/npm/v/@drieam/common.svg?maxAge=3600)](https://www.npmjs.com/package/@drieam/common) # [@drieam/common](https://github.com/Drieam/drieam-ui/tree/develop/packages/common) This package include some utilities used by Drieam LTI apps. ## Getting Started ### Installation Install the [@drieam/common](https://www.npmjs.com/package/@drieam/common) and its dependencies. ```bash yarn add @drieam/common @drieam/api @drieam/models @drieam/ui ``` ### Usage ```js import { connectActions, connectReducers } from '@drieam/api'; import * as models from '@drieam/models'; import { setStore } from '@drieam/common'; type API = { user: models.canvas.user; }; type Store = RootReducer<{ api: ConnectReducers<API>; }>; const api: ApiRoutes<API> = { user: { onError, path: '/lti/proxy/api/v1/users/:id?', mapper: models.canvas.User, list: true, }, }; const actions = connectActions<API>(api); const rootReducer = connectReducers<API>(api); const store = setStore( api, rootReducer, [/** EMPTY MIDDLEWARES **/], defaultOptions, )({ /* EMPTY INITIAL STATE */ }); ``` Read the full [API Documentation](../../docs/common/setStore.md) ## Components [`ApiTable`](../../docs/common/apiTable.md) [`ApiWrapper`](../../docs/common/apiWrapper.md) ## Contributing We welcome all contributors who abide by our [Code of Conduct](../../CODE_OF_CONDUCT.md). Please see the [Contributors Guide](../../CONTRIBUTING.md) for more details on submitting a PR, setting up a local dev environment, running tests, etc... ## Versioning Until this project reaches a 1.0 milestone, minor version numbers will simply be incremented during each release. The [Changelog](./CHANGELOG.md) will continue to document the different types of updates, including any "breaking changes". After the 1.0 milestone, this project will follow [SemVer](http://semver.org/). ## License To Be Fill..