Something went wrong. Try again.
This repository has no description
Something went wrong. Try again.
841 B · 31 lines
TSX
1234567891011121314151617181920212223242526272829303132import { place } from "streamplace";import { useDID, useStreamplaceStore } from "./streamplace-store";import { usePDSAgent } from "./xrpc";
export default function useGetIngests() { const pdsAgent = usePDSAgent(); const did = useDID(); const setIngests = useStreamplaceStore((state) => state.setIngests);
return async () => { if (!pdsAgent || !did) { throw new Error("No PDS agent or DID available"); }
const result = await pdsAgent.client.call( place.stream.ingest.getIngestUrls, );
const ingests = result.ingests .map((ingest) => { if (place.stream.ingest.defs.ingest.isTypeOf(ingest)) { return ingest; } console.error("Invalid ingest", ingest); return null; }) .filter((ingest) => ingest !== null);
setIngests(ingests); };}