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
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
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
Notes
Use a FormData object and send it with Fetch. Roughly,
Estimate
M/L