From dc8b0d405f8d886133ff1e82a677aea916a6e1c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Ho=C3=A0i=20Danh?= <33005392+nguyenhoaidanh@users.noreply.github.com> Date: Wed, 6 Sep 2023 09:35:53 +0700 Subject: [PATCH] fix: wrong name profile when change wallet (#2218) --- src/components/Header/web3/SignWallet/ConfirmModal.tsx | 6 +++++- src/hooks/social.ts | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/components/Header/web3/SignWallet/ConfirmModal.tsx b/src/components/Header/web3/SignWallet/ConfirmModal.tsx index aa5f792460..f14f4cecf7 100644 --- a/src/components/Header/web3/SignWallet/ConfirmModal.tsx +++ b/src/components/Header/web3/SignWallet/ConfirmModal.tsx @@ -38,7 +38,7 @@ const Highlight = styled.span` const ModalConfirmProfile: React.FC = () => { const theme = useTheme() - const isOpen = useSelector((state: AppState) => state.authen.showConfirmProfile) + const setConfirm = useSetConfirmChangeProfile() const [connectSuccess, setConnectSuccess] = useState(false) @@ -51,6 +51,10 @@ const ModalConfirmProfile: React.FC = () => { const navigate = useNavigate() const isMobile = useMedia(`(max-width: ${MEDIA_WIDTHS.upToExtraSmall}px)`) + const isOpen = + useSelector((state: AppState) => state.authen.showConfirmProfile) && + signedAccount?.toLowerCase?.() !== account?.toLowerCase?.() + useEffect(() => { if (!isOpen) setTimeout(() => { diff --git a/src/hooks/social.ts b/src/hooks/social.ts index 61ddefd4b6..a45d998ca7 100644 --- a/src/hooks/social.ts +++ b/src/hooks/social.ts @@ -15,8 +15,8 @@ export const useUploadImageToCloud = () => { try { const file = fileObject as File const ext = file.name?.split('.')?.pop() ?? '' - if (!IMAGE_ALLOW_EXTENSIONS.includes(ext) && file.name) throw new Error('File is not support') - const fileName = `${uuid() + Date.now()}.${ext}` + if (ext && !IMAGE_ALLOW_EXTENSIONS.includes(ext)) throw new Error('File is not support') + const fileName = `${uuid() + Date.now()}.${ext || 'png'}` const res = await uploadImage({ fileName, }).unwrap()