2023-11-15 12:12:06 -06:00
|
|
|
import { CollectionIncludingMembersAndLinkCount } from "@/types/global";
|
2023-06-14 17:34:54 -05:00
|
|
|
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;
|