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

Standardize fetch API #2352

Closed
wants to merge 2 commits into from

Conversation

elliottlawrence
Copy link

@elliottlawrence elliottlawrence commented May 17, 2024

Pull Request Checklist

  • Target branch: Pull requests should target the dev branch.
  • Description: Briefly describe the changes in this pull request.
  • Changelog: Ensure a changelog entry following the format of Keep a Changelog is added at the bottom of the PR description.
  • Documentation: Have you updated relevant documentation Open WebUI Docs, or other documentation sources?
  • Dependencies: Are there any new dependencies? Have you updated the dependency versions in the documentation?
  • Testing: Have you written and run sufficient tests for the changes?
  • Code Review: Have you self-reviewed your code and addressed any coding standard issues?

Description

There are quite a few places in the frontend code that use a similar pattern of calling fetch() and then dealing with error handling. This should probably be standardized with a helper function.


Changelog Entry

Added

Fixed

Changed

  • Refactored fetch calls to have standardized error handling

Removed

Security

Breaking Changes


Additional Information

I tried to be somewhat cautious about changing existing callsites of fetch. Most of them follow the same pattern but some are slightly different and I left those as-is. I figured this would be a good start and the rest can be cleaned up later.

I did a sanity check that the UI still seems to work, but there are quite a few changes here so I haven't tested every API call.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is where I added the new helper function.

@elliottlawrence elliottlawrence marked this pull request as ready for review May 17, 2024 19:02
@tjbck tjbck closed this May 18, 2024
@elliottlawrence
Copy link
Author

@tjbck - Any reason this PR was closed?

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

Successfully merging this pull request may close these issues.

None yet

2 participants