Skip to content

Commit

Permalink
Redirect to telegram bot if user have no telegram data
Browse files Browse the repository at this point in the history
  • Loading branch information
teodorus-nathaniel committed Sep 9, 2024
1 parent c1c82d0 commit c432dd0
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/hooks/useRedirectToTgBotOnDesktop.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { getReferralIdInUrl } from '@/components/referral/ReferralUrlChanger'
import { getReferralLink } from '@/components/referral/utils'
import { isTouchDevice } from '@/utils/device'
import { useMiniAppRaw } from '@tma.js/sdk-react'
import { useEffect } from 'react'
import useIsMounted from './useIsMounted'
Expand All @@ -11,9 +10,7 @@ const useRedirectToTgBotOnDesktop = () => {

const hasTelegramLoginInfo = app?.result
useEffect(() => {
const isMobile = isTouchDevice()

if (!isMobile && !hasTelegramLoginInfo && isMounted) {
if (!hasTelegramLoginInfo && isMounted) {
window.location.href = getReferralLink(getReferralIdInUrl())
}
}, [hasTelegramLoginInfo, isMounted])
Expand Down

0 comments on commit c432dd0

Please sign in to comment.