feat: UI bind api service toggling

This commit is contained in:
2025-06-03 00:07:09 +02:00
parent 900d314a95
commit 95c330568d

View File

@ -2,7 +2,7 @@ import Breadcrumbs from "@/components/ui/breadcrumbs";
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { useAdmin } from "@/store/admin";
import { useEffect, type FC } from "react";
import { useCallback, useEffect, type FC } from "react";
import { Link, useParams } from "react-router";
const InfoCard = ({
@ -29,6 +29,9 @@ const ViewApiServicePage: FC = () => {
const loadService = useAdmin((state) => state.fetchApiService);
const toggling = useAdmin((state) => state.togglingApiService);
const toggle = useAdmin((state) => state.toggleApiService);
useEffect(() => {
if (typeof serviceId === "string") loadService(serviceId);
}, [loadService, serviceId]);
@ -181,7 +184,8 @@ const ViewApiServicePage: FC = () => {
? "text-red-400 hover:text-red-500"
: "text-green-400 hover:text-green-500"
}
onClick={() => {}}
onClick={toggle}
loading={toggling}
>
{apiService.is_active ? "Disable" : "Enable"}
</Button>