@@ -17,6 +17,7 @@ import { saveChildEvents } from '../state/EventActions';
1717import getEventOrEventGroupOccurrenceRefetchQueries from '../getEventOrEventGroupOccurrenceRefetchQueries' ;
1818import AppConfig from '../../app/AppConfig' ;
1919import graphqlClient from '../../api/client' ;
20+ import { useProfileContext } from '../../profile/hooks/useProfileContext' ;
2021
2122interface UnenrolModalProps {
2223 isOpen : boolean ;
@@ -37,6 +38,7 @@ const UnenrolModal = ({
3738 const { t } = useTranslation ( ) ;
3839 const dispatch = useDispatch ( ) ;
3940 const getPathname = useGetPathname ( ) ;
41+ const { refetchProfile } = useProfileContext ( ) ;
4042
4143 const [ unenrolOccurrence ] = useMutation <
4244 UnenrolOccurrenceMutation ,
@@ -48,7 +50,7 @@ const UnenrolModal = ({
4850 eventGroupId,
4951 } ) ,
5052 awaitRefetchQueries : true ,
51- onCompleted : ( data ) => {
53+ onCompleted : async ( data ) => {
5254 if ( data . unenrolOccurrence ?. child ?. occurrences . edges ) {
5355 dispatch (
5456 saveChildEvents ( {
@@ -57,6 +59,9 @@ const UnenrolModal = ({
5759 } )
5860 ) ;
5961 }
62+
63+ await refetchProfile ( ) ;
64+
6065 navigate ( getPathname ( `/profile/child/${ childId } ` ) , { replace : true } ) ;
6166 } ,
6267 } ) ;
0 commit comments