Spent about 4 -5 hours yesterday because of that bug in previous lesson, didn't know why that happened . Thanks for solving this issue!
@bagathijogarao8064 Жыл бұрын
const handleSubmit = async () => { if (assignment) { const newAssignment: Assignment = {...assignment}; if (assignment.status === assignmentStatuses?.[0].status) newAssignment.status = assignmentStatuses?.[1].status; await updateAssignment.mutate(newAssignment) } } this also works fine😅
@ishtakkar32566 ай бұрын
Just changed my save function like this: const save = async () => { const data = await ajax(`/api/assignments/${assignmentId}`, "PUT", jwt, { ...assignmentData, status: assignmentStatuses[1].status, }); setAssignment(data); }; This will have to be further refined if we wish to change the status later in the future to something other than "Submitted".