Skip to content

Commit 28b1f11

Browse files
committed
fix: optimize state effects in assignments client
1 parent ac9c5d5 commit 28b1f11

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

app/dashboard/assignments/AssignmentsClient.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ export function AssignmentsClient() {
344344
description: a.description,
345345
subject: a.subject,
346346
class: a.class,
347-
deadline: a.deadline,
347+
deadline: a.deadline.slice(0, 10),
348348
maxMarks: a.maxMarks,
349349
});
350350
setModalOpen(true);
@@ -387,14 +387,17 @@ export function AssignmentsClient() {
387387
),
388388
);
389389
try {
390-
await fetch(`/api/assignments/${id}`, {
390+
const res = await fetch(`/api/assignments/${id}`, {
391391
method: "PUT",
392392
headers: { "Content-Type": "application/json" },
393393
body: JSON.stringify({
394394
kanbanStatus: col,
395395
status: col === "submitted" ? "closed" : "active",
396396
}),
397397
});
398+
if (!res.ok) {
399+
throw new Error(`HTTP ${res.status}`);
400+
}
398401
} catch (error) {
399402
fetchAssignments();
400403
toast(

0 commit comments

Comments
 (0)