@profi.co/hegnar-mws-token-hook
TypeScript icon, indicating that this package has built-in type declarations

1.3.1 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i @profi.co/hegnar-mws-token-hook

Weekly Downloads

102

Version

1.3.1

License

ISC

Unpacked Size

12.3 kB

Total Files

10

Last publish

Collaborators

  • proficopkgs