fix: rename useAdmin
to useApiServices
This commit is contained in:
@ -2,7 +2,7 @@ import Breadcrumbs from "@/components/ui/breadcrumbs";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import ApiServiceCredentialsModal from "@/feature/ApiServiceCredentialsModal";
|
||||
import { useAdmin } from "@/store/admin";
|
||||
import { useApiServices } from "@/store/admin";
|
||||
import { useCallback, type FC } from "react";
|
||||
import { useForm } from "react-hook-form";
|
||||
import { Link } from "react-router";
|
||||
@ -28,9 +28,9 @@ const ApiServiceCreatePage: FC = () => {
|
||||
},
|
||||
});
|
||||
|
||||
const createApiService = useAdmin((state) => state.createApiService);
|
||||
const createApiService = useApiServices((state) => state.create);
|
||||
|
||||
const credentials = useAdmin((state) => state.createdCredentials);
|
||||
const credentials = useApiServices((state) => state.createdCredentials);
|
||||
|
||||
const onSubmit = useCallback(
|
||||
(data: FormData) => {
|
||||
|
@ -2,7 +2,7 @@ import Breadcrumbs from "@/components/ui/breadcrumbs";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import ApiServiceUpdatedModal from "@/feature/ApiServiceUpdatedModal";
|
||||
import { useAdmin } from "@/store/admin";
|
||||
import { useApiServices } from "@/store/admin";
|
||||
import { useCallback, useEffect, type FC } from "react";
|
||||
import { useForm } from "react-hook-form";
|
||||
import { Link, useParams } from "react-router";
|
||||
@ -28,13 +28,13 @@ const ApiServiceEditPage: FC = () => {
|
||||
});
|
||||
|
||||
const { serviceId } = useParams();
|
||||
const apiService = useAdmin((state) => state.viewApiService);
|
||||
const apiService = useApiServices((state) => state.view);
|
||||
|
||||
const loadService = useAdmin((state) => state.fetchApiService);
|
||||
const loadService = useApiServices((state) => state.fetch);
|
||||
|
||||
const updateApiService = useAdmin((state) => state.updateApiService);
|
||||
const updating = useAdmin((state) => state.updatingApiService);
|
||||
const updated = useAdmin((state) => state.updatedApiService);
|
||||
const updateApiService = useApiServices((state) => state.update);
|
||||
const updating = useApiServices((state) => state.updating);
|
||||
const updated = useApiServices((state) => state.updated);
|
||||
|
||||
const onSubmit = useCallback(
|
||||
(data: FormData) => {
|
||||
|
@ -1,7 +1,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 { useApiServices } from "@/store/admin";
|
||||
import { useEffect, type FC } from "react";
|
||||
import { Link, useParams } from "react-router";
|
||||
|
||||
@ -24,13 +24,13 @@ const InfoCard = ({
|
||||
|
||||
const ViewApiServicePage: FC = () => {
|
||||
const { serviceId } = useParams();
|
||||
const apiService = useAdmin((state) => state.viewApiService);
|
||||
// const loading = useAdmin((state) => state.fetchingApiService);
|
||||
const apiService = useApiServices((state) => state.view);
|
||||
// const loading = useApiServices((state) => state.fetchingApiService);
|
||||
|
||||
const loadService = useAdmin((state) => state.fetchApiService);
|
||||
const loadService = useApiServices((state) => state.fetchSingle);
|
||||
|
||||
const toggling = useAdmin((state) => state.togglingApiService);
|
||||
const toggle = useAdmin((state) => state.toggleApiService);
|
||||
const toggling = useApiServices((state) => state.toggling);
|
||||
const toggle = useApiServices((state) => state.toggle);
|
||||
|
||||
useEffect(() => {
|
||||
if (typeof serviceId === "string") loadService(serviceId);
|
||||
|
@ -1,14 +1,14 @@
|
||||
import Breadcrumbs from "@/components/ui/breadcrumbs";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { useAdmin } from "@/store/admin";
|
||||
import { useApiServices } from "@/store/admin";
|
||||
import { Plus } from "lucide-react";
|
||||
import { useEffect, type FC } from "react";
|
||||
import { Link } from "react-router";
|
||||
|
||||
const ApiServicesPage: FC = () => {
|
||||
const apiServices = useAdmin((state) => state.apiServices);
|
||||
const loading = useAdmin((state) => state.loadingApiServices);
|
||||
const fetchApiServices = useAdmin((state) => state.fetchApiServices);
|
||||
const apiServices = useApiServices((state) => state.apiServices);
|
||||
const loading = useApiServices((state) => state.loading);
|
||||
const fetchApiServices = useApiServices((state) => state.fetch);
|
||||
|
||||
useEffect(() => {
|
||||
fetchApiServices();
|
||||
|
Reference in New Issue
Block a user