"use client"; import {useState} from "react"; import * as kube from "../services/kubernetes/client"; export default function useKubernetes(){ const [loading,setLoading]=useState(false); async function execute(fn,...args){ setLoading(true); try{ return await fn(...args); }finally{ setLoading(false); } } return{ loading, clusters:(...a)=>execute(kube.clusters,...a), namespaces:(...a)=>execute(kube.namespaces,...a), pods:(...a)=>execute(kube.pods,...a), deployments:(...a)=>execute(kube.deployments,...a), services:(...a)=>execute(kube.services,...a), logs:(...a)=>execute(kube.logs,...a), scale:(...a)=>execute(kube.scale,...a), rollout:(...a)=>execute(kube.rollout,...a), deletePod:(...a)=>execute(kube.deletePod,...a) }; }