sandrinodimattia / use-auth0-hooks

An easy way to sign in with Auth0 in your React application (client-side) using React Hooks
https://nextjs-spa-auth0-demo.now.sh/
MIT License
74 stars 31 forks source link

[feat] Include useApi in this package #11

Closed ties-v closed 4 years ago

ties-v commented 4 years ago

πŸ™Thanks for this simple and straight forward package @sandrinodimattia! It is now almost no work to setup client side auth in react apps βš›πŸš€!

Suggested feature

Because SPA's usually need data from an API, I suggest to include the useApi hook in this package. This is the same useApi as you use in the example. If you agree I would be happy to create a PR for it πŸ”œ.

sandrinodimattia commented 4 years ago

Thanks for your feedback @ties-v. While it would be useful, I think providing a useApi hook is beyond the scope of this library. There's people using swr, GraphQL, websockets, ... that might have a variety of needs when it comes to interacting with other systems.

The only thing I think would make sense is a hook which can wrap a library, eg: a hook where you can provide axios, a GraphQL client, ...

ties-v commented 4 years ago

On a second thought, you are right @sandrinodimattia !

Also a wrapper is probably not that useful as it also differs per use case how often data needs to be fetched etc., so I will close this one.

PS: I was wondering if you have any plans for the future with this repo or is it mostly a proof of concept?