(value)
| 408 | }; |
| 409 | |
| 410 | const getAmount = async (value) => { |
| 411 | if (value === undefined) { |
| 412 | value = topUpCount; |
| 413 | } |
| 414 | setAmountLoading(true); |
| 415 | try { |
| 416 | const res = await API.post('/api/user/amount', { |
| 417 | amount: parseFloat(value), |
| 418 | top_up_code: topUpCode, |
| 419 | }); |
| 420 | if (res !== undefined) { |
| 421 | const { message, data } = res.data; |
| 422 | if (message === 'success') { |
| 423 | setAmount(parseFloat(data)); |
| 424 | } else { |
| 425 | setAmount(0); |
| 426 | Toast.error({ content: '错误:' + data, id: 'getAmount' }); |
| 427 | } |
| 428 | } else { |
| 429 | showError(res); |
| 430 | } |
| 431 | } catch (err) { |
| 432 | console.log(err); |
| 433 | } |
| 434 | setAmountLoading(false); |
| 435 | }; |
| 436 | |
| 437 | const getStripeAmount = async (value) => { |
| 438 | if (value === undefined) { |
no test coverage detected