Spaces:
Sleeping
Sleeping
File size: 701 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 31 32 33 | "use client";
import {useState} from "react";
import deployment from "../services/deployment/client";
export default function useDeployment(){
const [loading,setLoading]=useState(false);
async function run(fn,...args){
setLoading(true);
try{
const {data}=await fn(...args);
return data;
}finally{
setLoading(false);
}
}
return{
loading,
providers:(...a)=>run(deployment.providers,...a),
list:(...a)=>run(deployment.list,...a),
status:(...a)=>run(deployment.status,...a),
logs:(...a)=>run(deployment.logs,...a),
deploy:(...a)=>run(deployment.deploy,...a),
redeploy:(...a)=>run(deployment.redeploy,...a),
cancel:(...a)=>run(deployment.cancel,...a),
remove:(...a)=>run(deployment.remove,...a)
};
}
|