Skip to content

Commit

Permalink
Update HeaderModal.jsx
Browse files Browse the repository at this point in the history
  • Loading branch information
DmytroPrymachenko committed Mar 19, 2024
1 parent 9879d67 commit 7729e74
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/components/Header/HeaderModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,23 @@ const HeaderModal = () => {
}, [isModalOpen, isHeaderModalOpen, isHeaderModalLogOut]);

useEffect(() => {
if (isModalOpen || isHeaderModalOpen || isHeaderModalLogOut) {
if (isModalOpen || isHeaderModalLogOut) {
document.body.style.overflow = 'hidden';
} else {
document.body.style.overflow = 'auto';
}
}, [isModalOpen, isHeaderModalOpen, isHeaderModalLogOut]);

useEffect(() => {
if (userProfile) {
userProfile?.avatarURL;
setImageUser(userProfile.avatarURL);
if (userProfile && userProfile.avatarURL) {
let avatarURL = userProfile.avatarURL;

if (avatarURL.startsWith('avatars')) {
avatarURL = `https://byte-water-back.onrender.com/${avatarURL}`;
}
setImageUser(avatarURL);
}
}, [userProfile, userProfile?.avatarURL]);
}, [userProfile]);

const openModal = () => {
setIsModalOpen(true);
Expand Down

0 comments on commit 7729e74

Please sign in to comment.