edit referrals page, add referrals fetch functions
This commit is contained in:
@@ -11,8 +11,25 @@ import navigation from './navigation.json';
|
||||
import { useSideMenuStore } from '@/app/stores/sideMenuStore';
|
||||
import { useRef } from 'react';
|
||||
import { useClickOutside } from '@/app/hooks/useClickOutside';
|
||||
import { fetchReferralUserStats } from '@/app/actions/referralsActions';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
|
||||
export default function NavLinks() {
|
||||
const {
|
||||
data: referralLink,
|
||||
isLoading,
|
||||
isError,
|
||||
error
|
||||
} = useQuery({
|
||||
queryKey: ['referralUserStats'],
|
||||
queryFn: () => {
|
||||
return fetchReferralUserStats();
|
||||
},
|
||||
select: (data) => {
|
||||
return data?.referralLink;
|
||||
}
|
||||
});
|
||||
|
||||
const pathname = usePathname().replace('/en/', '/').replace('/ru/', '/');
|
||||
const t = useTranslations('Global');
|
||||
|
||||
@@ -69,6 +86,10 @@ export default function NavLinks() {
|
||||
<DropDownList />
|
||||
|
||||
{links.map((link) => {
|
||||
if (!referralLink && link.name === 'referral-program') {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<Link
|
||||
key={link.name}
|
||||
|
||||
Reference in New Issue
Block a user