Skip to content

Commit

Permalink
Merge pull request #3077 from IX-Swap/fix/referral-link
Browse files Browse the repository at this point in the history
Fix referral link
  • Loading branch information
leonthuongto authored Jan 16, 2025
2 parents ce8c3d4 + 1a0dfa8 commit f21c813
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/components/AccountDetails/ReferFriend.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const ReferFriend: React.FC<ReferFriendProps> = ({ referralCode }) => {
<BoxContainer>
<ReferCode>{referralCode}</ReferCode>

<Copy toCopy={`${window.location.origin}/#/kyc?referralCode=${referralCode}`} />
<Copy toCopy={`${window.location.origin}/kyc?referralCode=${referralCode}`} />
</BoxContainer>
</div>
)
Expand Down
15 changes: 14 additions & 1 deletion src/pages/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,17 @@ export default function App() {
}
}, [token, account, chainId])

useEffect(() => {
const code = query.get('referralCode')
if (!code) {
return
}
const storedReferralCode = localStorage.getItem('referralCode')
if (!storedReferralCode) {
localStorage.setItem('referralCode', code)
}
}, [])

if (!config) {
return <LoadingIndicator isLoading />
}
Expand Down Expand Up @@ -306,7 +317,9 @@ export default function App() {
</Portal>
) : null}

{openTaskSuccessModal && <TaskSuccessModal show={openTaskSuccessModal} onClose={() => setOpenTaskSuccessModal(false)} />}
{openTaskSuccessModal && (
<TaskSuccessModal show={openTaskSuccessModal} onClose={() => setOpenTaskSuccessModal(false)} />
)}
</>
)
}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/KYC/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ const KYC = () => {
<StyledDiv>
<TitleSpan>{referralCode}</TitleSpan>
<FlexContainer>
<Copy toCopy={`${window.location.origin}/#/kyc?referralCode=${referralCode}`}></Copy>
<Copy toCopy={`${window.location.origin}/kyc?referralCode=${referralCode}`}></Copy>
</FlexContainer>
</StyledDiv>
</Column>
Expand Down

0 comments on commit f21c813

Please sign in to comment.