Skip to content

Commit

Permalink
Fix ShareLocationModal
Browse files Browse the repository at this point in the history
  • Loading branch information
tassoevan committed Dec 31, 2024
1 parent 3893c33 commit 6d0dd97
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ type ShareLocationModalProps = {
const ShareLocationModal = ({ rid, tmid, onClose }: ShareLocationModalProps): ReactElement => {
const t = useTranslation();
const dispatchToast = useToastMessageDispatch();
const { data: permissionData, isLoading: permissionLoading } = useQuery({
const { data: permissionState, isLoading: permissionLoading } = useQuery({
queryKey: ['geolocationPermission'],
...getGeolocationPermission,
queryFn: getGeolocationPermission,
});
const { data: positionData } = useQuery({
queryKey: ['geolocationPosition', permissionData],
queryKey: ['geolocationPosition', permissionState],

queryFn: async () => {
if (permissionLoading || permissionData === 'prompt' || permissionData === 'denied') {
if (permissionLoading || permissionState === 'prompt' || permissionState === 'denied') {
return;
}
return getGeolocationPosition();
Expand Down Expand Up @@ -68,7 +68,7 @@ const ShareLocationModal = ({ rid, tmid, onClose }: ShareLocationModalProps): Re
}
};

if (permissionLoading || permissionData === 'prompt') {
if (permissionLoading || permissionState === 'prompt') {
return (
<GenericModal
title={t('You_will_be_asked_for_permissions')}
Expand All @@ -80,7 +80,7 @@ const ShareLocationModal = ({ rid, tmid, onClose }: ShareLocationModalProps): Re
);
}

if (permissionData === 'denied' || !positionData) {
if (permissionState === 'denied' || !positionData) {
return (
<GenericModal title={t('Cannot_share_your_location')} confirmText={t('Ok')} onConfirm={onClose} onClose={onClose}>
{t('The_necessary_browser_permissions_for_location_sharing_are_not_granted')}
Expand Down

0 comments on commit 6d0dd97

Please sign in to comment.