-
-
Notifications
You must be signed in to change notification settings - Fork 763
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
[React] API Image Functionality #5696
[React] API Image Functionality #5696
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. |
@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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 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).