Spaces:
Sleeping
Sleeping
File size: 515 Bytes
cce8120 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | "use client";
import {useState} from "react";
import lowcode from "../services/lowcode/client";
export default function useLowCode(){
const [loading,setLoading]=useState(false);
async function run(fn,...args){
setLoading(true);
try{
return await fn(...args);
}
finally{
setLoading(false);
}
}
return{
loading,
list:(...a)=>run(lowcode.list,...a),
load:(...a)=>run(lowcode.load,...a),
save:(...a)=>run(lowcode.save,...a),
runWorkflow:(...a)=>run(lowcode.run,...a),
remove:(...a)=>run(lowcode.delete,...a)
};
}
|