UNPKG

@atlaskit/profilecard

Version:

A React component to display a card with user information.

25 lines 663 B
import { useState } from 'react'; export const useProfileInfo = ({ fetchUserProfile }) => { const [isLoading, setIsLoading] = useState(false); const [error, setError] = useState(null); const [profileData, setProfileData] = useState(); const getProfileData = async () => { setIsLoading(true); try { const profileData = await (fetchUserProfile === null || fetchUserProfile === void 0 ? void 0 : fetchUserProfile()); setProfileData(profileData); setIsLoading(false); } catch (error) { setError(error); setIsLoading(false); } }; return { profileData, isLoading, error, getProfileData }; };