Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create custom useApi() hook #44

Open
jjh121 opened this issue Apr 10, 2020 · 0 comments
Open

Create custom useApi() hook #44

jjh121 opened this issue Apr 10, 2020 · 0 comments

Comments

@jjh121
Copy link
Owner

jjh121 commented Apr 10, 2020

Create a custom useApi() hook that can manage isLoading, errors, isSuccessful (?), and the return type. This should be able to handle gets and posts. It should take a param for the URL segment for the API, but encapsulate the process.env.API_URL within it. It should also take a param to determine if it should run at first or be delayed (i.e. we don't want POSTs to run on load, but GETs we probably do)

Once useApi() hook is created, replace all API calls with it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant