Skip to content

Fix: ID card generation TypeError due to API response change - #105

Open
sentry[bot] wants to merge 1 commit into
masterfrom
seer/fix/sh-staff-app-e-id-card-generation
Open

Fix: ID card generation TypeError due to API response change#105
sentry[bot] wants to merge 1 commit into
masterfrom
seer/fix/sh-staff-app-e-id-card-generation

Conversation

@sentry

@sentry sentry Bot commented Jul 25, 2026

Copy link
Copy Markdown

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 generate method in candidate.id.card.service.ts was calling this._authhttp.generateCards. This generateCards method was designed to handle blob responses (e.g., for file downloads) and explicitly returned undefined after 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 in candidate-list.page.ts received undefined and crashed when attempting to access response.operation.

Solution:
Updated the generate method in candidate.id.card.service.ts to use this._authhttp.post(url, { candidates }) instead of this._authhttp.generateCards. This ensures that the JSON response from the API is correctly returned to the calling component, allowing the response.operation property to be accessed as expected. The filename variable, 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

@linear-code

linear-code Bot commented Jul 25, 2026

Copy link
Copy Markdown

TECH-2058

@netlify

netlify Bot commented Jul 25, 2026

Copy link
Copy Markdown

Deploy Preview for studenthub-staff ready!

Name Link
🔨 Latest commit 8f22383
🔍 Latest deploy log https://app.netlify.com/projects/studenthub-staff/deploys/6a6540ec65f09c0008504aa4
😎 Deploy Preview https://deploy-preview-105--studenthub-staff.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

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.

0 participants