File tree Expand file tree Collapse file tree
client/src/components/Admin Expand file tree Collapse file tree Original file line number Diff line number Diff 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" >
You can’t perform that action at this time.
0 commit comments