Skip to content

Commit 662f29d

Browse files
authored
Merge pull request #468 from amahuli03/467/unauthorized-pdf-upload
Fix 401 by using adminApi instead of raw axios
2 parents 98599e5 + f96606d commit 662f29d

1 file changed

Lines changed: 2 additions & 7 deletions

File tree

frontend/src/pages/DocumentManager/UploadFile.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { useState, useRef } from "react";
2-
import axios from "axios";
2+
import { adminApi } from "../../api/apiClient";
33
import TypingAnimation from "../../components/Header/components/TypingAnimation.tsx";
44
import Layout from "../Layout/Layout.tsx";
55

@@ -22,14 +22,9 @@ const UploadFile: React.FC = () => {
2222
formData.append("file", file);
2323

2424
try {
25-
const response = await axios.post(
25+
const response = await adminApi.post(
2626
`/api/v1/api/uploadFile`,
2727
formData,
28-
{
29-
headers: {
30-
"Content-Type": "multipart/form-data"
31-
},
32-
}
3328
);
3429
console.log("File uploaded successfully", response.data);
3530
} catch (error) {

0 commit comments

Comments
 (0)