Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function useTablesAndKeys(app, appLayout) {
const [tablesAndKeys] = usePromise(() => app.getTablesAndKeys({}, {}, 0, true, false), [appLayout.qLastReloadTime]);
return tablesAndKeys;
}
const useProcessingSpeed = () => {
const { t } = useTranslation();
const [dynamicFees = {}, error, status] = usePromise(getDynamicFees, []);
const isLoading = status === 'pending';
const [processingSpeedState, setProcessingSpeedState] = useState({
value: 0,
isLoading,
selectedIndex: 0,
});
const selectProcessingSpeed = ({ item, index }) => {
setProcessingSpeedState({
...processingSpeedState,
...item,
selectedIndex: index,
isLoading,
error: !!error,
});
export default function useModel(app, def) {
const [model, error] = usePromise(() => app.getOrCreateObject(def), [app.id + JSON.stringify(def)]);
if (error) throw error;
return model;
}