Skip to content

fix: send real decline request in Vouch page #66

Description

@EmeditWeb

Problem

In Vouch.tsx (lines 179-183), the handleDecline function uses setTimeout(() => r(), 600) to simulate declining a vouch request. No API call is made. The request visually disappears from the UI after 600ms but reappears on page refresh because the decline was never persisted.

User impact: Mentors believe they have declined vouch requests, but the requests keep reappearing. This creates confusion and undermines trust in the platform.

Root Cause

The decline action was stubbed during initial development. The API endpoint POST /vouching/decline or equivalent exists (vouching.controller.ts) but was never wired to the frontend.

What To Build

  1. Add declineVouch(requestId) method to vouching.service.ts
  2. Replace the setTimeout + fake decline in Vouch.tsx with real API call
  3. Add loading spinner on the decline button while request is in flight
  4. Add error toast if decline fails
  5. Remove the declined request from local state on success

Files To Touch

  • src/pages/Vouch.tsx — lines 179-183 replace fake decline
  • src/services/vouching.service.ts — add declineVouch method

Acceptance Criteria

  • Decline sends API request to backend
  • Loading state on decline button during API call
  • Error toast shown if decline fails
  • Declined request removed from UI on success
  • Declined requests stay gone after page refresh
  • No setTimeout used for simulating API calls anywhere

Mandatory Checks

  • context/ files read
  • npm run build passes
  • npm test passes
  • PR references this issue

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions