Skip to content

Commit

Permalink
fixed send notif delegate issue
Browse files Browse the repository at this point in the history
  • Loading branch information
mishramonalisha76 committed Aug 21, 2024
1 parent 5add89b commit 7281bc7
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/modules/sendNotification/SendNotification.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,30 @@ 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

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 (
Expand Down Expand Up @@ -71,6 +79,7 @@ const SendNotification: FC = () => {
type={UNLOCK_PROFILE_TYPE.MODAL}
showConnectModal={true}
onClose={() => setIsAuthModalVisible(false)}
description="Unlock your profile to proceed."
/>
</Box>
)}
Expand Down

0 comments on commit 7281bc7

Please sign in to comment.