Repository navigation
[React] API Image Functionality - #5696
Merged
Merged
Conversation
- Do not force "/api/" prefix to the base URL of the server - We will need to fetch media files from the server (at /media/) - Extend API URL helper functions
- Used to fetch images from API which require auth - Requires some tweaks to back-end CORS settings - Otherwrise, image loading won't work on new API
✅ Deploy Preview for inventree-web-pui-preview ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Member
Author
|
@matmair LMK what you think of this approach in general. There might be a better way to handle this? But I could not find a cleaner approach after much searching |
# Conflicts: # src/frontend/src/components/renderers/GeneralRenderer.tsx # src/frontend/src/components/tables/build/BuildOrderTable.tsx # src/frontend/src/components/tables/part/PartTable.tsx # src/frontend/src/components/tables/part/RelatedPartTable.tsx
matmair
reviewed
Oct 16, 2023
matmair
left a comment
Member
There was a problem hiding this comment.
Seems to work; I think it should also work with just linking the media files but there is some CORS stuff that needs to be set up correctly for that to work.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

This PR adds image loading function to the new react interface.
Currently, images hosted by the InvenTree server cannot be loaded by the front end, due to two reasons:
./platform/)So. a new
<ApiImage>component is provided, which fetches image data (using the user token). Note that browser caching is used for fetched images, so they need only be fetched once (or once per session).