|
@@ -1,5 +1,7 @@
|
|
|
"use client";
|
|
|
import { CashbackTypes } from "@/api/cashback";
|
|
|
+import { CashbackStatusEnum, CashbackStatusMap } from "@/enums";
|
|
|
+import { useRouter } from "@/i18n/routing";
|
|
|
import { server } from "@/utils/client";
|
|
|
import { brTimeFormat } from "@/utils/methods";
|
|
|
import { Toast } from "antd-mobile";
|
|
@@ -12,11 +14,12 @@ interface Props {
|
|
|
}
|
|
|
const Extract = (props: Props) => {
|
|
|
const { local, cashbackInfo } = props;
|
|
|
+ const router = useRouter();
|
|
|
const [scope, animate] = useAnimate();
|
|
|
|
|
|
const t = useTranslations();
|
|
|
const getCashbackGiveApi = () => {
|
|
|
- if (cashbackInfo.status !== "pending") {
|
|
|
+ if (cashbackInfo.status !== CashbackStatusEnum.PENDING) {
|
|
|
animate(
|
|
|
scope.current,
|
|
|
{ color: ["#000", "#ffaa30", "#000"] },
|
|
@@ -26,6 +29,9 @@ const Extract = (props: Props) => {
|
|
|
repeatType: "loop",
|
|
|
}
|
|
|
);
|
|
|
+ setTimeout(() => {
|
|
|
+ router.push("/");
|
|
|
+ }, 2000);
|
|
|
return;
|
|
|
}
|
|
|
if (cashbackInfo.amount === 0) {
|
|
@@ -73,7 +79,7 @@ const Extract = (props: Props) => {
|
|
|
}
|
|
|
onClick={getCashbackGiveApi}
|
|
|
>
|
|
|
- <span>{t("cashback.receiveButton")}</span>
|
|
|
+ <span>{t(CashbackStatusMap.get(cashbackInfo.status))}</span>
|
|
|
</div>
|
|
|
</>
|
|
|
);
|