LinkDesk/frontend/docs/shot-endpoint-fix.md

2.0 KiB

Shot Endpoint Fix - Browser Cache Issue

Problem

After updating the shot service endpoints, the browser shows "Request failed with status code 404" when trying to load shots. The backend logs show requests to /projects/1/shots?episode_id=2, which is the old endpoint.

Root Cause

The browser has cached the old JavaScript bundle that contains the old API endpoints. Even though the source code has been updated, the browser is still using the cached version.

Solution

Hard refresh the browser to clear the cache and load the new JavaScript bundle:

Windows/Linux

  • Press Ctrl + Shift + R
  • OR Press Ctrl + F5

Mac

  • Press Cmd + Shift + R

Alternative Method (All Platforms)

  1. Open browser DevTools (F12)
  2. Right-click the refresh button in the browser toolbar
  3. Select "Empty Cache and Hard Reload"

Verification

After hard refreshing, the browser should:

  1. Load shots successfully
  2. Backend logs should show requests to /shots?episode_id=X (new endpoint)
  3. No more 404 errors

Technical Details

Updated Endpoints

The shot service has been updated to use the correct backend routes:

Old (incorrect):

  • GET /projects/{projectId}/shots?episode_id={episodeId}
  • GET /projects/{projectId}/shots/{shotId}
  • POST /projects/{projectId}/episodes/{episodeId}/shots
  • PUT /projects/{projectId}/shots/{shotId}
  • DELETE /projects/{projectId}/shots/{shotId}

New (correct):

  • GET /shots?episode_id={episodeId}
  • GET /shots/{shotId}
  • POST /shots?episode_id={episodeId}
  • PUT /shots/{shotId}
  • DELETE /shots/{shotId}
  • POST /shots/bulk?episode_id={episodeId} (bulk creation)

Files Updated

  • frontend/src/services/shot.ts - All service methods updated
  • frontend/src/components/shot/ShotBrowser.vue - All service calls updated

Backend Verification

The backend endpoints have been tested and are working correctly:

python backend/test_shots_endpoint.py

All tests pass, confirming the backend is ready for the new frontend code.