Skip to content

Note Uploading #4

@p1an0guy

Description

@p1an0guy

Feature

First, check if the user is logged in with auth.getSession(). If they're not logged in, redirect to the /auth route.
In the /dashboard route, implment a simple button that sets "isUploadOpen" to True. Once isUploadOpen is true, use react-dropzone for drag-and-drop upload functionality. After the file gets uploaded, prompt the user for class and the title of the note, and have a confirmation button. Check that the name/class/etc is not empty. Once they confirm, pass that into an api call to the /api/upload route. (For now, you can implement a mock API response that always returns HTTP status 200 with some generic message). On HTTP status 200 response from the upload API, add credits to the user's account (let's go with 5 for now)

Acceptance criteria

  • Program prompts user for title/description/course info when they drag a file to upload
  • Program successfully uploads the file to Supabase storage (pending the implmentation of the upload API)
  • Program successfully adds credits to the user's account if the upload was successful

Notes

Use a FormData object and send it with Fetch. Roughly,

const formData = new FormData()
formData.append("file", file)
// append other information

await fetch("/api/upload", {
    method: "POST",
    body: formdata,
});

Estimate

M/L

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions