From 1a0dfa82f273820817a5ae017f40d650c6ae7d0c Mon Sep 17 00:00:00 2001 From: thi-investax Date: Thu, 16 Jan 2025 09:57:07 +0700 Subject: [PATCH] Fix referral link --- src/components/AccountDetails/ReferFriend.tsx | 2 +- src/pages/App.tsx | 15 ++++++++++++++- src/pages/KYC/index.tsx | 2 +- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/components/AccountDetails/ReferFriend.tsx b/src/components/AccountDetails/ReferFriend.tsx index 9170826be5..f287375598 100644 --- a/src/components/AccountDetails/ReferFriend.tsx +++ b/src/components/AccountDetails/ReferFriend.tsx @@ -14,7 +14,7 @@ const ReferFriend: React.FC = ({ referralCode }) => { {referralCode} - + ) diff --git a/src/pages/App.tsx b/src/pages/App.tsx index ad71f4e537..fc6c95efbb 100644 --- a/src/pages/App.tsx +++ b/src/pages/App.tsx @@ -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 } @@ -306,7 +317,9 @@ export default function App() { ) : null} - {openTaskSuccessModal && setOpenTaskSuccessModal(false)} />} + {openTaskSuccessModal && ( + setOpenTaskSuccessModal(false)} /> + )} ) } diff --git a/src/pages/KYC/index.tsx b/src/pages/KYC/index.tsx index 131da799c1..d680c8c34b 100644 --- a/src/pages/KYC/index.tsx +++ b/src/pages/KYC/index.tsx @@ -442,7 +442,7 @@ const KYC = () => { {referralCode} - +