giraffe icon indicating copy to clipboard operation
giraffe copied to clipboard

Clear error message from Check-In API

Open yaxit24 opened this issue 3 months ago • 5 comments

Fixes: #36 and isuse in Backend #809.

Summary by Sourcery

Improve check-in feedback by handling API responses to display specific success and error notifications and refresh orders accordingly.

Enhancements:

  • Show "Check-in successful!" or "Already Checked-in!" notifications based on API response statuses
  • Display server-provided error messages on check-in failure or fall back to a generic failure notice
  • Refresh order list after handling both success and error responses

yaxit24 avatar Jul 30 '25 12:07 yaxit24

Reviewer's Guide

Refactor checkIn method to parse API responses and render targeted notifications for success, redeemed, and error outcomes, while enhancing error handling to display detailed messages.

Sequence diagram for improved check-in API error handling and notifications

sequenceDiagram
    actor User
    participant UI as EventyaySearchCheckIn.vue
    participant API as Check-In API
    participant Notification as notificationStore

    User->>UI: Initiate check-in (click)
    UI->>API: POST /orderpositions/{id}/checkin/
    alt API returns status 'ok' or 'redeemed'
        API-->>UI: { status: 'ok' | 'redeemed' }
        UI->>Notification: addNotification(['Check-in successful!' or 'Already Checked-in!'], 'success')
        UI->>UI: searchOrders() (refresh)
    else API returns status 'error'
        API-->>UI: { status: 'error', message }
        UI->>Notification: addNotification([message or 'Check-in failed!'], 'error')
        UI->>UI: searchOrders() (refresh)
    else API call throws error
        API--xUI: Error
        alt error.response.data.status == 'error'
            UI->>Notification: addNotification([error.response.data.message or 'Check-in failed!'], 'error')
        else
            UI->>Notification: addNotification(['Check-in failed!'], 'error')
        end
    end

File-Level Changes

Change Details Files
Implement explicit API response handling in checkIn
  • Capture and inspect response.status after API call
  • Show 'success' notification on status 'ok'
  • Show 'success' notification for 'redeemed' status with custom message
  • Show 'error' notification with API-provided message when status 'error'
src/components/Eventyay/EventyaySearchCheckIn.vue
Enhance catch block to surface detailed errors
  • Log caught errors to console
  • Check for error.response.data.status === 'error'
  • Display notification with detailed error message from response
  • Fallback to generic error notification if no detailed message
src/components/Eventyay/EventyaySearchCheckIn.vue

Possibly linked issues

  • #809: PR adds error handling and notifications for Check-In API responses, addressing the issue.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an issue from a review comment by replying to it. You can also reply to a review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull request title to generate a title at any time. You can also comment @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in the pull request body to generate a PR summary at any time exactly where you want it. You can also comment @sourcery-ai summary on the pull request to (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the pull request to resolve all Sourcery comments. Useful if you've already addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull request to dismiss all existing Sourcery reviews. Especially useful if you want to start fresh with a new review - don't forget to comment @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

  • Contact our support team for questions or feedback.
  • Visit our documentation for detailed guides and information.
  • Keep in touch with the Sourcery team by following us on X/Twitter, LinkedIn or GitHub.

sourcery-ai[bot] avatar Jul 30 '25 12:07 sourcery-ai[bot]

Deploy Preview for eventyay-checkin ready!

Name Link
Latest commit aac6042463be7d638b44ff9369cf34123cdd48e8
Latest deploy log https://app.netlify.com/projects/eventyay-checkin/deploys/688a51222235650008cefe37
Deploy Preview https://deploy-preview-37--eventyay-checkin.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.

netlify[bot] avatar Jul 30 '25 12:07 netlify[bot]

Could you add a screen shot of the notification, also once checked it must be a pop-up that shows the attendee info with buttons to manually print the badge not just a notification.

Sak1012 avatar Jul 30 '25 16:07 Sak1012

IMAGE 2025-07-30 22:45:12

All seems working well.

yaxit24 avatar Jul 30 '25 17:07 yaxit24

https://github.com/user-attachments/assets/c79778d8-1d99-4f59-b4e7-e54d2dae82ac

yaxit24 avatar Jul 30 '25 19:07 yaxit24