mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-05-19 17:58:24 -05:00
15 lines
404 B
TypeScript
15 lines
404 B
TypeScript
import { GetAllSalmonRunRecordsData } from "prisma/queries/getAllSalmonRunRecords";
|
|
import useSWR from "swr";
|
|
|
|
export function useSalmonRunRecords() {
|
|
const { data = [] } = useSWR<GetAllSalmonRunRecordsData>("/api/sr/records");
|
|
|
|
return {
|
|
data: data.filter((record) => record.approved),
|
|
pendingCount: data.reduce(
|
|
(acc, record) => (!record.approved ? ++acc : acc),
|
|
0
|
|
),
|
|
};
|
|
}
|