import {useEffect, useState} from "react";
import type {Gallery_Catalog} from "../protocol/gallery_types";
import {load_gallery_catalog} from "../transport/catalog_loader";
export function use_gallery_catalog(): {catalog: Gallery_Catalog|null; state: string; message: string} {const [catalog,set_catalog]=useState<Gallery_Catalog|null>(null);const [status,set_status]=useState({state:"connecting",message:"读取后端目录"});useEffect(()=>load_gallery_catalog(set_catalog,(state,message)=>set_status({state,message})),[]);return {catalog,...status};}
