el.xwx.moe/lib/client/getPublicCollectionData.ts

20 lines
485 B
TypeScript
Raw Normal View History

2023-11-15 12:12:06 -06:00
import { CollectionIncludingMembersAndLinkCount } from "@/types/global";
import { Dispatch, SetStateAction } from "react";
2023-06-02 22:50:16 -05:00
const getPublicCollectionData = async (
2023-06-15 07:39:30 -05:00
collectionId: number,
2023-11-15 12:12:06 -06:00
setData: Dispatch<
SetStateAction<CollectionIncludingMembersAndLinkCount | undefined>
>
2023-06-02 22:50:16 -05:00
) => {
2023-11-15 12:12:06 -06:00
const res = await fetch("/api/v1/public/collections/" + collectionId);
2023-05-29 14:40:23 -05:00
const data = await res.json();
2023-11-15 12:12:06 -06:00
setData(data.response);
2023-05-29 14:40:23 -05:00
return data;
};
export default getPublicCollectionData;