Skip to content
Snippets Groups Projects
useGetDataServiceList.tsx 517 B
Newer Older
import { getDataServiceList } from "@/api/cubicweb";
import { DataService } from "@/types";
import { useEffect, useState } from "react";

export function useGetDataServiceList() {
  const [loading, setLoading] = useState(true);
  const [data, setData] = useState<Array<DataService> | undefined>(undefined);

  useEffect(() => {
    setLoading(true);
    getDataServiceList().then((result) => {
      console.log(result);
      setLoading(false);
      setData(result);
    });
  }, []);
  return { loading, data };
}