From e1b36975018524ccf3e77fe5a2f4b406ce81d3a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=B0lyas=20Keskin?= Date: Mon, 9 Sep 2024 11:39:55 +0300 Subject: [PATCH] fix --- app/(auth)/sign-up/page.jsx | 4 ++-- components/shared/photo/AvatarEdit.jsx | 12 +++++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/app/(auth)/sign-up/page.jsx b/app/(auth)/sign-up/page.jsx index 9d9ea72..d6b839a 100644 --- a/app/(auth)/sign-up/page.jsx +++ b/app/(auth)/sign-up/page.jsx @@ -3,11 +3,11 @@ import Lottie from "lottie-react"; import logo from "../../../public/logo.json"; import SignUpForm from "@/components/shared/common/Forms/SignUpForm"; import { firebaseAuth } from "@/utils/FirebaseConfig"; -import { useRouter } from "next/navigation"; import { useEffect } from "react"; +import { useRouter } from "next/navigation"; const SignUp = () => { - const router = useRouter(); + const router = useRouter; const currentUser = firebaseAuth.currentUser; useEffect(() => { if (!currentUser) { diff --git a/components/shared/photo/AvatarEdit.jsx b/components/shared/photo/AvatarEdit.jsx index 1a3132e..4c72556 100644 --- a/components/shared/photo/AvatarEdit.jsx +++ b/components/shared/photo/AvatarEdit.jsx @@ -17,10 +17,16 @@ const AvatarEdit = ({ imgURL, setImgURL }) => { const imageRef = useRef(null); const [open, setOpen] = useState(false); const { handleImageChange } = usePrevImg(imgURL, setImgURL); + const [isMobileDevice, setIsMobileDevice] = useState(false); - const isMobileDevice = /Mobi|Android|iPhone|iPad|iPod/i.test( - navigator.userAgent - ); + useEffect(() => { + if (typeof window !== "undefined" && typeof navigator !== "undefined") { + const isMobile = /Mobi|Android|iPhone|iPad|iPod/i.test( + navigator.userAgent + ); + setIsMobileDevice(isMobile); + } + }, []); const handleOpen = () => setOpen(true);