@profi.co/hegnar-mws-token-hook
v2.0.2
Published
This plugin is used to as a hook to fetch MWS token from Hegnar web.
Downloads
732
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-hookor with yarn:
yarn add @profi.co/hegnar-mws-token-hookUsage
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:
2.0.0
- Instead of returning null or accessToken as string we return an object (BREAKING CHANGE)
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
