diff --git a/src/components/User/UserDashBoard.tsx b/src/components/User/UserDashBoard.tsx index ccc4efa17..9cdcd2aeb 100644 --- a/src/components/User/UserDashBoard.tsx +++ b/src/components/User/UserDashBoard.tsx @@ -54,7 +54,7 @@ const UserDashBoard = () => { const [message, setMessage] = useState(''); const [ecoMessage, setEcoMessage] = useState(''); const [viewButton, setViewButton] = useState(false); - const [error, setError] = useState(''); + const [error, setError] = useState(''); const [currentPage, setCurrentPage] = useState(initialPageState); const [organizationsList, setOrganizationList] = useState | null>(null); @@ -106,8 +106,8 @@ const UserDashBoard = () => { total: totalPages, }); } else { - setError(response as string); - // setError('Failed to fetch invitations'); + // setError(response as string); + setError('Failed to fetch invitations'); } } catch(err) { setError('An unexpected error occurred'); @@ -162,8 +162,8 @@ const UserDashBoard = () => { total: totalPages, }); } else { - setError(response as string); - // setError('Failed to fetch invitations'); + // setError(response as string); + setError('Failed to fetch invitations'); } } catch(err){ @@ -450,41 +450,38 @@ const UserDashBoard = () => { ); }; - console.log("errror_:::::::::::", typeof error); - console.log("mesaage---:::::::::", typeof message); return ( <>
- {(error !== '' || message !== '') && - { - setMessage(''); - setError(''); - }} - /> - } + {(error || message) && ( // Check if either error or message exists + { + setMessage(''); // Reset message on close + setError(''); // Reset error on close + }} + /> + )}
- {(error !== '' || ecoMessage !== '') && - { - setEcoMessage(''); - setError(''); - }} - /> -} + {(error || ecoMessage) && ( // Check if either error or ecoMessage exists + { + setEcoMessage(''); // Reset ecoMessage on close + setError(''); // Reset error on close + }} + /> + )}
{walletData && walletData.length > 0 ? ( <>