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

Function getOptions

web/src/components/settings/OperationSetting.js:48–68  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

46 let [loading, setLoading] = useState(false);
47
48 const getOptions = async () => {
49 const res = await API.get('/api/option/');
50 const { success, message, data } = res.data;
51 if (success) {
52 let newInputs = {};
53 data.forEach((item) => {
54 if (
55 item.key.endsWith('Enabled') ||
56 ['DefaultCollapseSidebar'].includes(item.key)
57 ) {
58 newInputs[item.key] = toBoolean(item.value);
59 } else {
60 newInputs[item.key] = item.value;
61 }
62 });
63
64 setInputs(newInputs);
65 } else {
66 showError(message);
67 }
68 };
69 async function onRefresh() {
70 try {
71 setLoading(true);

Callers 1

onRefreshFunction · 0.70

Calls 2

toBooleanFunction · 0.90
showErrorFunction · 0.90

Tested by

no test coverage detected