From 7281bc70e60929d4683d81ee558c6eb9d101cd28 Mon Sep 17 00:00:00 2001 From: Monalisha Mishra Date: Wed, 21 Aug 2024 17:26:08 +0530 Subject: [PATCH] fixed send notif delegate issue --- src/modules/sendNotification/SendNotification.tsx | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/modules/sendNotification/SendNotification.tsx b/src/modules/sendNotification/SendNotification.tsx index d6f5ad5639..eca4aaa5c6 100644 --- a/src/modules/sendNotification/SendNotification.tsx +++ b/src/modules/sendNotification/SendNotification.tsx @@ -8,9 +8,11 @@ import { SendNotificationForm } from './components/SendNotificationForm'; import UnlockProfileWrapper, { UNLOCK_PROFILE_TYPE } from 'components/chat/unlockProfile/UnlockProfileWrapper'; import { UserStoreType } from 'types'; -import { useGetChannelDetails } from 'queries'; +import { useGetAliasInfo, useGetChannelDetails } from 'queries'; import { useAccount } from 'hooks'; import { useNavigate } from 'react-router-dom'; +import { aliasChainIdToChainName } from 'helpers/UtilityHelper'; +import { ALIAS_CHAIN } from '@pushprotocol/restapi/src/lib/config'; //add formik //add conditon for /send url @@ -18,12 +20,18 @@ import { useNavigate } from 'react-router-dom'; const SendNotification: FC = () => { const [isAuthModalVisible, setIsAuthModalVisible] = useState(true); const { userPushSDKInstance } = useSelector((state: UserStoreType) => state.user); - const { account } = useAccount(); + const { account, chainId } = useAccount(); const { data: channelDetails } = useGetChannelDetails(account); + const { data: alaisDetails } = useGetAliasInfo({ + alias: account, + aliasChain: aliasChainIdToChainName[chainId as keyof typeof aliasChainIdToChainName] as ALIAS_CHAIN, + }); + const { delegatees } = useSelector((state: any) => state.admin); const nagivate = useNavigate(); + console.debug(delegatees, alaisDetails, 'delegtees'); useEffect(() => { - if (!channelDetails) nagivate('/channels'); + if (!channelDetails && !delegatees?.length && !alaisDetails) nagivate('/channels'); }, [channelDetails]); return ( @@ -71,6 +79,7 @@ const SendNotification: FC = () => { type={UNLOCK_PROFILE_TYPE.MODAL} showConnectModal={true} onClose={() => setIsAuthModalVisible(false)} + description="Unlock your profile to proceed." /> )}