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

Surface status code in state #319

Closed
generalpiston opened this issue Feb 27, 2021 · 8 comments
Closed

Surface status code in state #319

generalpiston opened this issue Feb 27, 2021 · 8 comments

Comments

@generalpiston
Copy link

Status codes are useful for front end state management. For example, an API that return 403 and 401 can be treated differently. Also, sometimes APIs return 202 for async processing.

@generalpiston
Copy link
Author

Here's an example: generalpiston@b8e3f57.

@generalpiston
Copy link
Author

Added PR: #320

@rstire364
Copy link

Is there any concern about the implications of this change with non-request async functions?

@generalpiston
Copy link
Author

@rstire364 great point. I didn't think about it. Would it make sense to make it optional?

@rstire364
Copy link

This might not be a popular answer but I think it's a user-land issue. I would argue this change borders on a violation of separation of concerns. React Async is concerned with providing an abstraction around async state management.

To be fair, I've used React Async exclusively with Axios, so status and statusCode are readily available. This further reinforces my thought that this is a request library responsibility and not React Async's.

@generalpiston
Copy link
Author

To your point @rstire364 . I could have also just made accept another value as well.

@rstire364
Copy link

Certainly a valid

@generalpiston
Copy link
Author

Let's close this then. Thanks @rstire364

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

2 participants