mirror of
https://github.com/inaturalist/iNaturalistReactNative.git
synced 2026-06-20 05:28:29 -04:00
* Use eslint rules to clean up useQuery code * Code cleanup for useAuthenticatedMutation * Add realm deletion and clear mock before each test in DeleteObservationDialog
29 lines
576 B
JavaScript
29 lines
576 B
JavaScript
// @flow
|
|
import { fetchUserMe } from "api/users";
|
|
import useAuthenticatedQuery from "sharedHooks/useAuthenticatedQuery";
|
|
import useCurrentUser from "sharedHooks/useCurrentUser";
|
|
|
|
const useUserMe = ( ): Object => {
|
|
const currentUser = useCurrentUser( );
|
|
|
|
const {
|
|
data: remoteUser,
|
|
isLoading,
|
|
refetch: refetchUserMe
|
|
} = useAuthenticatedQuery(
|
|
["fetchUserMe"],
|
|
optsWithAuth => fetchUserMe( { }, optsWithAuth ),
|
|
{
|
|
enabled: !!currentUser
|
|
}
|
|
);
|
|
|
|
return {
|
|
remoteUser,
|
|
isLoading,
|
|
refetchUserMe
|
|
};
|
|
};
|
|
|
|
export default useUserMe;
|