49 lines
2.2 KiB
Markdown
49 lines
2.2 KiB
Markdown
# Tuitio client react
|
|
|
|
## Introduction
|
|
|
|
Tuitio client react is an npm package written in typescript that facilitates the integration of a react application with [Tuitio](https://lab.code-rove.com/gitea/tudor.stanciu/tuitio).
|
|
|
|
This package uses [tuitio-client](https://lab.code-rove.com/gitea/bricks/tuitio-client#readme) internally and adds state management through react contexts and various react hooks through which the user has access to data and actions.
|
|
|
|
## Package installation
|
|
|
|
The package installation can be done in two ways:
|
|
|
|
- from the command line: `npm install @flare/tuitio-client-react`
|
|
- from the package.json file: `"@flare/tuitio-client-react": "1.0.0"`
|
|
|
|
## How to use the package
|
|
|
|
```javascript!
|
|
const { TuitioProvider, useTuitioClient, useTuitioUser, useTuitioToken, useTuitioUserInfo } = require("@flare/tuitio-client-react");
|
|
const TuitioProvider = require("@flare/tuitio-client-react");
|
|
|
|
```
|
|
|
|
```javascript!
|
|
import { TuitioProvider, useTuitioClient, useTuitioUser, useTuitioToken, useTuitioUserInfo } from "@flare/tuitio-client-react";
|
|
import TuitioProvider from "@flare/tuitio-client-react";
|
|
```
|
|
|
|
## Unit testing
|
|
|
|
Unit testing is done using [Jest](https://jestjs.io/). This is an awesome testing framework created by Facebook.
|
|
The files containing tests are identified by the extension `*.test.ts`.
|
|
All tests in the package can be executed by running: `npm test`.
|
|
|
|
## Changelog
|
|
|
|
1.0.0 - Package initialization.
|
|
1.0.1 - Added useTuitioClient default options.
|
|
1.1.0 - In this version, the account logout method and the latest changes published by Tuitio were implemented.
|
|
1.1.1 - Account logout bug fix.
|
|
1.2.0 - Has been implemented the "user-info" method exposed by the Tuitio API and the latest changes published by "@flare/tuitio-client".
|
|
1.2.1 - Added decodedToken in useTuitioToken hook. The token is obtained directly from TuitioProvider's react context.
|
|
1.2.2 - Upgraded @flare/tuitio-client and @flare/js-utils packages.
|
|
1.2.3 - User roles were handled in useTuitioUserInfo hook.
|
|
1.2.4 - Upgraded @flare/tuitio-client.
|
|
1.2.5 - Upgraded @flare/tuitio-client.
|
|
1.2.6 - Removed specific user groups and roles. Records must be dynamic.
|
|
1.2.7 - Set react version range in peer dependencies.
|