Skip to content

Pass userId to /api/submissions GET endpoint from frontend#22

Closed
Copilot wants to merge 3 commits intofeat/personal-sitefrom
copilot/sub-pr-13-9f287e9a-fcff-46e3-b8ec-0c19f849fa93
Closed

Pass userId to /api/submissions GET endpoint from frontend#22
Copilot wants to merge 3 commits intofeat/personal-sitefrom
copilot/sub-pr-13-9f287e9a-fcff-46e3-b8ec-0c19f849fa93

Conversation

Copy link
Contributor

Copilot AI commented Feb 12, 2026

The /api/submissions GET handler requires userId as a query parameter, but frontend calls were omitting it, causing 400 errors when loading user submissions.

Changes:

  • MySubmissions component: Accept userId prop and include in API call as query parameter
  • UserDashboard component: Pass authenticated user's ID to MySubmissions
  • Wrap loadSubmissions in useCallback to satisfy React exhaustive-deps
// Before
const response = await fetch('/api/submissions');

// After  
const response = await fetch(`/api/submissions?userId=${encodeURIComponent(userId)}`);

This aligns local dev behavior with production, where both the dev server (server/dev-server.js) and production API (api/submissions.ts) enforce the userId requirement.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI mentioned this pull request Feb 12, 2026
@vercel
Copy link

vercel bot commented Feb 12, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
string-v2 Ready Ready Preview, Comment Feb 12, 2026 4:09pm

Copilot AI and others added 2 commits February 12, 2026 16:06
Updated MySubmissions component to accept userId prop and include it in API calls. This fixes the missing userId parameter issue in the GET /api/submissions endpoint.

Co-authored-by: ghostleek <44336310+ghostleek@users.noreply.github.com>
Wrapped loadSubmissions in useCallback to properly handle React hook dependencies and prevent stale closures.

Co-authored-by: ghostleek <44336310+ghostleek@users.noreply.github.com>
Copilot AI changed the title [WIP] Update personal site features based on feedback Pass userId to /api/submissions GET endpoint from frontend Feb 12, 2026
Copilot AI requested a review from ghostleek February 12, 2026 16:10
@ghostleek ghostleek marked this pull request as ready for review February 13, 2026 16:23
@ghostleek ghostleek closed this Feb 13, 2026
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.

2 participants