@@ -34,7 +34,7 @@ import BaseMap from '#components/domain/BaseMap';
3434import Link , { type Props as LinkProps } from '#components/Link' ;
3535import MapContainerWithDisclaimer from '#components/MapContainerWithDisclaimer' ;
3636import MapPopup from '#components/MapPopup' ;
37- import usePermissions from '#hooks/domain/usePermissions ' ;
37+ import useAuth from '#hooks/domain/useAuth ' ;
3838import useFilterState from '#hooks/useFilterState' ;
3939import {
4040 COLOR_DARK_GREY ,
@@ -131,21 +131,17 @@ function LocalUnitsMap() {
131131 [ limit , filter , countryResponse ] ,
132132 ) ;
133133
134- const { isCountryAdmin , isSuperUser } = usePermissions ( ) ;
134+ const { isAuthenticated } = useAuth ( ) ;
135135
136136 const requestType = useMemo (
137137 ( ) => {
138- if ( isSuperUser ) {
139- return 'authenticated' ;
140- }
141-
142- if ( isCountryAdmin ( countryResponse ?. id ) ) {
138+ if ( isAuthenticated ) {
143139 return 'authenticated' ;
144140 }
145141
146142 return 'public' ;
147143 } ,
148- [ countryResponse , isSuperUser , isCountryAdmin ] ,
144+ [ isAuthenticated ] ,
149145 ) ;
150146
151147 const {
@@ -166,7 +162,7 @@ function LocalUnitsMap() {
166162 query : urlQuery ,
167163 } ) ;
168164
169- const localUnits = ( isSuperUser || isCountryAdmin ( countryResponse ?. id ) )
165+ const localUnits = requestType === AUTHENTICATED
170166 ? localUnitsResponse : publicLocalUnitsResponse ;
171167 const pending = publicLocalUnitsPending || localUnitsPending ;
172168
0 commit comments