|
@@ -172,7 +172,7 @@ const Withdraw = () => {
|
|
|
length?: number;
|
|
|
}
|
|
|
) => {
|
|
|
- const toValue = value.replace(/[^0-9]/, "");
|
|
|
+ const toValue = value.replace(/[^0-9]/gi, "");
|
|
|
let toAmount = "";
|
|
|
if (toValue) {
|
|
|
toAmount = new BigNumber(toValue).toFixed(0, BigNumber.ROUND_DOWN);
|
|
@@ -235,27 +235,31 @@ const Withdraw = () => {
|
|
|
};
|
|
|
|
|
|
const extractHandler = async () => {
|
|
|
- const values = formInstanceRef.current?.getFieldValues();
|
|
|
- const { passport, name, last_name, amount, account_no } = values;
|
|
|
- if (!amount) {
|
|
|
- return;
|
|
|
- }
|
|
|
- const params: WithDrawParams = {
|
|
|
- passport,
|
|
|
- channel_id: currentType.id,
|
|
|
- amount: Number(amount),
|
|
|
- account_no,
|
|
|
- user_name: `${name} ${last_name}`,
|
|
|
- };
|
|
|
+ const loadingRef = Toast.show({ icon: "loading", duration: 0 });
|
|
|
+ try {
|
|
|
+ const values = formInstanceRef.current?.getFieldsValue();
|
|
|
+ const { passport, name, last_name, amount, account_no } = values;
|
|
|
+ if (!amount) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const params: WithDrawParams = {
|
|
|
+ passport,
|
|
|
+ channel_id: currentType.id,
|
|
|
+ amount: Number(amount),
|
|
|
+ account_no,
|
|
|
+ user_name: `${name} ${last_name}`,
|
|
|
+ };
|
|
|
|
|
|
- const withResult = await getWithDrawApi(params).catch((error) => {
|
|
|
+ const withResult = await getWithDrawApi(params);
|
|
|
+ loadingRef.close();
|
|
|
+ if (withResult && withResult.code === 200) {
|
|
|
+ Toast.show(t("code.200"));
|
|
|
+ }
|
|
|
+ await clearWallet();
|
|
|
+ } catch (error: any) {
|
|
|
+ loadingRef.close();
|
|
|
Toast.show(t(`code.${error.data.code}`));
|
|
|
- });
|
|
|
- if (withResult && withResult.code === 200) {
|
|
|
- Toast.show(t("code.200"));
|
|
|
}
|
|
|
-
|
|
|
- await clearWallet();
|
|
|
};
|
|
|
// const goGame = () => {
|
|
|
// const current = game.current;
|