馃幆 Due April 12th, 2023
Taarika Bala, Siara Small, Alex Lee, Alyssa Williams
Your task for this week and a half is to add functionality to the AddSenior page, so that you can generate a new model and store it on submission of the form!
Specifically, you'll be writing the handleSubmit functions specified in add-senior.tsx. Don't worry about the event parameter passed in; you'll be using the properties in seniorData to construct a new model.
Finally, create and push your new model. You'll be using your function written in src/pages/api/senior/add.ts. Check out the handleSubmit() code snippet below from refine.dev on how to use your routes.
function handleSubmit(e) {
e.preventDefault();
const postData = async () => {
const data = {
title: title,
post: post,
};
const response = await fetch("/api/post", {
method: "POST",
body: JSON.stringify(data),
});
return response.json();
};
postData().then((data) => {
alert(data.message);
});
}
We anticipate that the Google Drive part will be a little trickier鈥撀爎each out to me or Michael if you have any questions.
馃幆 Due April 12th, 2023
Taarika Bala, Siara Small, Alex Lee, Alyssa Williams
Your task for this week and a half is to add functionality to the
AddSeniorpage, so that you can generate a new model and store it on submission of the form!Specifically, you'll be writing the
handleSubmitfunctions specified inadd-senior.tsx. Don't worry about theeventparameter passed in; you'll be using the properties inseniorDatato construct a new model.Usermodels.add-senior.tsxhas a dropdown of potential student names; so, replace thedropDataparameter in the<AddProfile>with these names!Seniormodel. You'll populate fields likenameandlocationwith the data passed into thehandleSubmit()function. Other fields are more specific:StudentIDsandStudentswill describe all associatedUsers. A newSeniorhas no files. Furthermore, on creation of a new senior, you'll want to give them a unique folder in Google Drive...file.data.idvalue: this is what you'll store in theSeniormodel'sfolderfield, so thatSenior's files can be retrieved later.Finally, create and push your new model. You'll be using your function written in
src/pages/api/senior/add.ts. Check out thehandleSubmit()code snippet below from refine.dev on how to use your routes.We anticipate that the Google Drive part will be a little trickier鈥撀爎each out to me or Michael if you have any questions.