From 3e20cf339c2cfe1f8e66945149ceb09a7ff68490 Mon Sep 17 00:00:00 2001 From: Sverre Nystad Date: Sun, 14 Jan 2024 19:01:06 +0100 Subject: [PATCH 1/2] Fix(#8): Correct uploadPDF function to send pdf and not json with pdf --- frontend/src/services/uploadService.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/frontend/src/services/uploadService.ts b/frontend/src/services/uploadService.ts index 7f4e7b01..40cd4597 100644 --- a/frontend/src/services/uploadService.ts +++ b/frontend/src/services/uploadService.ts @@ -11,11 +11,7 @@ const uploadPDF = async (file: File): Promise => { } const response = await axios - .post(apiRoutes.createFlashcards, { - method: "POST", - body: formData, - // Add headers if necessary (e.g., for authentication) - }) + .post(apiRoutes.createFlashcards, formData) .then((res) => { return res; }) From dcd3966aa7c3c06caa17ab07ade683ef7f1dba0e Mon Sep 17 00:00:00 2001 From: Sverre Nystad Date: Thu, 29 Feb 2024 15:50:09 +0100 Subject: [PATCH 2/2] Fix: Remove upload_pdf view from urls.py --- backend/api/urls.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/backend/api/urls.py b/backend/api/urls.py index d9ebce91..15925a66 100644 --- a/backend/api/urls.py +++ b/backend/api/urls.py @@ -1,14 +1,12 @@ from django.urls import path from users.views import login, register_user -from documents.views import upload_pdf from flashcards.views import generate_mock_flashcard from documents.views import create_flashcards urlpatterns = [ path("create-user/", register_user, name="create-user"), path("login/", login, name="login"), - path("upload/", upload_pdf, name="upload"), path("generate-mock-flashcard/", generate_mock_flashcard, name="generate-mock-flashcards"), path("create-flashcards/", create_flashcards, name="create-flashcards"), ]