Auth Provider
This is the provider component that will make the current user available through the useUserFromContext. Using this component and it's hook make easier to avoid multiple requests validating the token.
Under the hood, this component uses the useCurrentUser and make the returned value available.
Usage
// App.js
import { CroodsProvider } from 'croods'
import { AuthProvider, Auth, authHeaders, saveHeaders } from 'croods-auth'
export default props => (
<CroodsProvider
headers={authHeaders}
handleResponseHeaders={saveHeaders}
baseUrl="https://foo.bar"
>
<AuthProvider>
<MyComponents>
</AuthProvider>
</CroodsProvider>
)