react-authapp-container
A boilerplate app container that contains authentication sagas (react-boilerplate/react-native)
Installation
Using npm
npm install @source4society/react-authapp-container
Using yarn
yarn add @source4society/react-authapp-container
Setup
This container is intended to be used with SCEPTER-webui which is a modified fork of react-boilerplate or SCEPTER-mobileui based off of React Native.
Example
Include this container in your base app container, and pass it a Shell and LoadingIndicator component as follows:
<App shellComponent={Shell} loadingIndicatorComponent={LoadingIndicator} />
You can also pass custom props, which will be passed to the shell component as appProps
The shell will receive the following props from the App container:
isAuthenticated
userRoles
userId
username
expires
jwt
appProps
Please see the action.js
, reducer.js
, selectors.js
and saga.js
files for an understanding of how to manipulate the value of these properties.
React Native
For React Native applications, you must set localStorage to be the AsyncsStorage object on the global scope before mounting this container. You can replace localStorage with another storage implementation of choice so long as the interface is similar.