MCPcopy Create free account
hub / github.com/aiprodcoder/MIXAPI / getOptions

Function getOptions

web/src/components/settings/PaymentSetting.js:31–66  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

29 let [loading, setLoading] = useState(false);
30
31 const getOptions = async () => {
32 const res = await API.get('/api/option/');
33 const { success, message, data } = res.data;
34 if (success) {
35 let newInputs = {};
36 data.forEach((item) => {
37 switch (item.key) {
38 case 'TopupGroupRatio':
39 try {
40 newInputs[item.key] = JSON.stringify(JSON.parse(item.value), null, 2);
41 } catch (error) {
42 console.error('解析TopupGroupRatio出错:', error);
43 newInputs[item.key] = item.value;
44 }
45 break;
46 case 'Price':
47 case 'MinTopUp':
48 case 'StripeUnitPrice':
49 case 'StripeMinTopUp':
50 newInputs[item.key] = parseFloat(item.value);
51 break;
52 default:
53 if (item.key.endsWith('Enabled')) {
54 newInputs[item.key] = toBoolean(item.value);
55 } else {
56 newInputs[item.key] = item.value;
57 }
58 break;
59 }
60 });
61
62 setInputs(newInputs);
63 } else {
64 showError(t(message));
65 }
66 };
67
68 async function onRefresh() {
69 try {

Callers 1

onRefreshFunction · 0.70

Calls 3

toBooleanFunction · 0.90
showErrorFunction · 0.90
tFunction · 0.70

Tested by

no test coverage detected