UNPKG

react-playmakers

Version:

React wrapper providing utilities for PlayMakers integration

66 lines (46 loc) 1.25 kB
# react-playmakers Implementation of the PlayMakers API for ReactJS. ## Requirements The package.json needs to be tweaked to fulfill the minimum requirements ## Install ```sh npm install npm run build ``` Then, in your `package.json`, add the module: ```json ... "dependencies": { ... "react-playmakers":"file:./react-playmakers" } ... ``` ## Example use-cases ```javascript import {PlayMakersProvider} from "react-playmakers"; const PlayMakersConfig = { API_BASEURL: "https://api.playmakers.co" API_CACHE_EXPIRATION: 2000, BARISTA_VERSION: "0.2.3", PROJECT_ID: "xxx-xxxxx-xxx-xxxxx", }; const App = () => ( <Router> <PlayMakersProvider {...PlayMakersConfig}> ... </PlayMakersProvider> </Router> ); ``` ## Parts ### API - Provides functions wrapping all the end points - Provides object models (Project, Schema, Submission, ...) ### AuthContext & AccountLink - Handles authentication and cookies - Provides a button to login/logout ### Caching Some cache mechanism is built-in. API requests are not duplicated within the timeframe defined by `API_CACHE_EXPIRATION`. In a future release, some data will stay in cache for the duration of the session, unless it explicitely needs to be fetched newly.