Fix: ID card generation TypeError due to API response change - #105
Open
sentry[bot] wants to merge 1 commit into
Open
Fix: ID card generation TypeError due to API response change#105sentry[bot] wants to merge 1 commit into
sentry[bot] wants to merge 1 commit into
Conversation
✅ Deploy Preview for studenthub-staff ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
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 addresses issue SH-STAFF-APP-E, a
TypeError: Cannot read properties of undefined (reading 'operation')occurring during ID card generation.Root Cause:
The
generatemethod incandidate.id.card.service.tswas callingthis._authhttp.generateCards. ThisgenerateCardsmethod was designed to handle blob responses (e.g., for file downloads) and explicitly returnedundefinedafter processing the blob. However, the backend API for ID card generation has changed to return a JSON object ({ operation: 'success', cir_uuid: '...' }) for asynchronous processing, not a blob. Consequently, the caller incandidate-list.page.tsreceivedundefinedand crashed when attempting to accessresponse.operation.Solution:
Updated the
generatemethod incandidate.id.card.service.tsto usethis._authhttp.post(url, { candidates })instead ofthis._authhttp.generateCards. This ensures that the JSON response from the API is correctly returned to the calling component, allowing theresponse.operationproperty to be accessed as expected. Thefilenamevariable, which was only relevant for the blob download functionality, has also been removed as it is no longer needed.Fixes SH-STAFF-APP-E
Fixes TECH-2058