Skip to content

Commit

Permalink
Merge pull request #30993 from JKobrynski/migrateUsePrivatePersonalDe…
Browse files Browse the repository at this point in the history
…tailsToTypeScript

[TS Migration] migrate usePrivatePersonalDetails.js to TypeScript
  • Loading branch information
grgia authored Nov 9, 2023
2 parents c3692a7 + d5f72f8 commit e9fb54c
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
import {useContext, useEffect} from 'react';
import _ from 'underscore';
import {NetworkContext} from '@components/OnyxProvider';
import * as PersonalDetails from '@userActions/PersonalDetails';

/**
* Hook for fetching private personal details
*/
export default function usePrivatePersonalDetails() {
const {isOffline} = useContext(NetworkContext);
const network = useContext(NetworkContext);

useEffect(() => {
const personalDetails = PersonalDetails.getPrivatePersonalDetails();
if (isOffline || (Boolean(personalDetails) && !_.isUndefined(personalDetails.isLoading))) {
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
if (network?.isOffline || (Boolean(personalDetails) && personalDetails?.isLoading !== undefined)) {
return;
}

PersonalDetails.openPersonalDetailsPage();
}, [isOffline]);
}, [network?.isOffline]);
}

0 comments on commit e9fb54c

Please sign in to comment.