|
@@ -8,7 +8,8 @@ import { useTranslations } from "next-intl";
|
|
|
import { ChangeEvent, FC, ReactNode, useEffect } from "react";
|
|
|
import "./style.scss";
|
|
|
|
|
|
-import { getUserMoneyApi } from "@/api/user";
|
|
|
+import { getUserDepositApi, getUserMoneyApi } from "@/api/user";
|
|
|
+import { useEventPoint } from "@/hooks/useEventPoint";
|
|
|
import { useGlobalNoticeStore } from "@/stores/useGlobalNoticeStore";
|
|
|
import { useWalletStore } from "@/stores/useWalletStore";
|
|
|
import { useRequest } from "ahooks";
|
|
@@ -53,6 +54,7 @@ const tabList = [
|
|
|
const Footer: FC = () => {
|
|
|
const token = getToken();
|
|
|
const t = useTranslations("navBar");
|
|
|
+ const { eventPurchase, eventFirstDeposit } = useEventPoint();
|
|
|
|
|
|
const pathname = usePathname();
|
|
|
|
|
@@ -107,12 +109,33 @@ const Footer: FC = () => {
|
|
|
setWallet(res.data);
|
|
|
},
|
|
|
});
|
|
|
+ const { run: depositRun } = useRequest(getUserDepositApi, {
|
|
|
+ pollingInterval: 5000,
|
|
|
+ pollingWhenHidden: true,
|
|
|
+ pollingErrorRetryCount: 3,
|
|
|
+ staleTime: 5000,
|
|
|
+ manual: true,
|
|
|
+ refreshDeps: [token],
|
|
|
+ onError: (error) => {},
|
|
|
+ onSuccess: (res) => {
|
|
|
+ if (Object.keys(res.data).length < 0) return;
|
|
|
+
|
|
|
+ if (res.data.is_first_pay) {
|
|
|
+ eventFirstDeposit();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (res.data.is_success) {
|
|
|
+ eventPurchase();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ });
|
|
|
|
|
|
useEffect(() => {
|
|
|
if (getToken()) {
|
|
|
run();
|
|
|
walletRun();
|
|
|
userRun();
|
|
|
+ depositRun();
|
|
|
}
|
|
|
}, []);
|
|
|
|