-
-
Notifications
You must be signed in to change notification settings - Fork 16
Closed
Labels
BugSomething isn't workingSomething isn't working
Description
Steps to Reproduce
- Log in to the application
- Navigate to the Document Manager page
- Click "Upload File" and select a PDF
- Observe POST /api/v1/api/uploadFile returns 401 Unauthorized
Possible Fix Background
The project has two axios instances in frontend/src/api/apiClient.ts:
- publicApi — no auth headers
- adminApi — attaches Authorization: JWT from localStorage via a request interceptor
UploadFile.tsx:25 uses a raw axios.post(...) call (neither publicApi nor adminApi), so no Authorization header is sent. The backend UploadFileView
(server/api/views/uploadFile/views.py:21) requires IsAuthenticated for all non-GET methods, causing the 401.
Possible Fix
In frontend/src/pages/DocumentManager/UploadFile.tsx:
- Replace import axios from "axios" with import { adminApi } from "../../api/apiClient.ts"
- Change the upload call from axios.post(...) to adminApi.post(...) — the interceptor will automatically attach the JWT token, no other changes needed
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
BugSomething isn't workingSomething isn't working
Type
Projects
Status
Done