authenticated-fetch
A function that wraps a standard fetch call with logic to inject the current user's authentication token.
#
Installation#
InterfaceThis function has the same function signature as native fetch
#
ExampleSee tests for more examples.
If the function cannot acquire a token, or a 401 response is received, the user is automatically redirected to the login page. Redirection blocks promise resolution, so there will not be an opportunity to handle these cases.