UNPKG

@drieam/common

Version:

Default Drieam api wrapper

48 lines (35 loc) 1.52 kB
[![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 ``` Read the full [API Documentation](../../docs/common/setStore.md) ### `Options` General settings of an action as an extension of api actions. ```jsx { withErrorHandler: true, csrfToken: getCSRFToken(), history: createBrowserHistory(), toasts: { offline: { duration: 0, message: 'Not connected.', }, save: { message: 'Saved success.' }, delete: { message: 'Deleted success.' }, }, }; } ``` - Attributes: 1. `withErrorHandler` (`boolean`): Enables ErrorHandlingMiddleware (Default: `true`). Provides feedback through an [Antd Notification](https://ant.design/components/notification/) on offline, save success or fail action. 1. `toasts` (`object`): Notification settings, you can express which message can be provided by the error handler. 1. `history` (`object`): `history` is a JavaScript library that lets you easily manage session history anywhere JavaScript runs. (default: `require 'history'`). 1. `csfrToken` (`string`): Cross-site request forgery token. (Default: `<meta [name="csrf-token"] />`). 1. [Api options](/api/options)