File tree 1 file changed +4
-0
lines changed
1 file changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ import API from '@/api/api';
16
16
import Pagination from '@/Components/Pagination.tsx' ;
17
17
import { AxiosError } from 'axios' ;
18
18
import { useToast } from '@/Context/ToastCtx' ;
19
+ import { useRevalidator } from 'react-router-dom' ;
19
20
20
21
export default function FacilityManagement ( ) {
21
22
const addFacilityModal = useRef < HTMLDialogElement > ( null ) ;
@@ -39,6 +40,7 @@ export default function FacilityManagement() {
39
40
} = useSWR < ServerResponseMany < Facility > , AxiosError > (
40
41
`/api/facilities?page=${ pageQuery } &per_page=${ perPage } `
41
42
) ;
43
+ const { revalidate } = useRevalidator ( ) ;
42
44
43
45
const facilityData = facility ?. data ?? [ ] ;
44
46
@@ -58,6 +60,7 @@ export default function FacilityManagement() {
58
60
if ( state && message ) {
59
61
toaster ( message , state ) ;
60
62
}
63
+ revalidate ( ) ;
61
64
editFacilityModal . current ?. close ( ) ;
62
65
addFacilityModal . current ?. close ( ) ;
63
66
resetModal ( ) ;
@@ -84,6 +87,7 @@ export default function FacilityManagement() {
84
87
'Facility successfully deleted.' ,
85
88
ToastState . success
86
89
) ;
90
+ revalidate ( ) ;
87
91
} else {
88
92
toaster ( 'Error deleting Facility.' , ToastState . success ) ;
89
93
}
You can’t perform that action at this time.
0 commit comments