Skip to content

Commit 789ea8e

Browse files
committed
fixed name of announcement toggle
1 parent 01e4164 commit 789ea8e

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

client/src/components/Admin/Announcements.jsx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,8 @@ const Announcements = () => {
7373

7474
const handleIsEnabled = async (announcementId, isEnabled) => {
7575
try {
76-
await announcementService.update(announcementId, { is_enabled: isEnabled });
77-
setRows((prevRows) =>
78-
prevRows.map((row) =>
79-
row.announcementId === announcementId ? { ...row, is_enabled: isEnabled } : row
80-
)
81-
);
76+
await announcementService.update(announcementId, { is_enabled: isEnabled }); // updates database
77+
await announcementRefetch(); // updates UI with latest from database
8278
} catch (error) {
8379
console.error("Error updating announcement:", error);
8480
}
@@ -311,7 +307,7 @@ const Announcements = () => {
311307
onChange={announcementFormik.handleChange}
312308
/>
313309
}
314-
label="Globally Enable"
310+
label="Is Enabled?"
315311
/>
316312
</Box>
317313
<Box mt={3} display="flex" justifyContent="space-between">
@@ -381,7 +377,7 @@ const Announcements = () => {
381377
onChange={editFormik.handleChange}
382378
/>
383379
}
384-
label="Globally Enable"
380+
label="Is Enabled?"
385381
/>
386382
</Box>
387383
<Box mt={3} display="flex" justifyContent="space-between">

0 commit comments

Comments
 (0)