mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-26 09:16:22 +02:00
organiza podcasts apis
This commit is contained in:
parent
78ab020d80
commit
0e488c799d
4 changed files with 302 additions and 185 deletions
20
surfsense_web/lib/apis/documents.api.ts
Normal file
20
surfsense_web/lib/apis/documents.api.ts
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
const uploadDocument = async (formData: FormData) => {
|
||||
const response = await fetch(
|
||||
`${process.env.NEXT_PUBLIC_FASTAPI_BACKEND_URL}/api/v1/documents/fileupload`,
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
Authorization: `Bearer ${window.localStorage.getItem(
|
||||
"surfsense_bearer_token"
|
||||
)}`,
|
||||
},
|
||||
body: formData,
|
||||
}
|
||||
);
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error("Upload failed");
|
||||
}
|
||||
|
||||
await response.json();
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue