website-builder-backend / frontend /hooks /useDeployment.js
David Prince
fix: add all missing local module stubs (remote_mcp_registry, mcp_auth, mcp_transport, etc)
cce8120
Raw
History Blame Contribute Delete
701 Bytes
"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)
};
}