@profi.co/hegnar-mws-token-hook
v1.3.1
Published
This plugin is used to as a hook to fetch MWS token from Hegnar web.
Downloads
643
Readme
Hegnar MWS token fetching plugin by Profico
This plugin is used to as a hook to fetch MWS token from Hegnar web.
Installation
Install @profi.co/hegnar-mws-token-hook
with npm:
npm install @profi.co/hegnar-mws-token-hook
or with yarn:
yarn add @profi.co/hegnar-mws-token-hook
Usage
In a functional React component add the following
const token = useMillistreamMwsToken();
Then listen to a change in the token with e.g. useEffect(() => {}, [token])
Changelog:
1.3.1
- Before updating token remove the old one from local storage
1.3.0
- Replace useInterval with a setTimeout
1.1.9
- Now really Mark token expired 10min before actual expiration (logic was in the wrong direction so it expired 10min after)
1.1.8
- Mark token expired 10min before actual expiration
1.1.7
- Prevent saving invalid response to local storage