certimate/ui/src/api/statistics.ts
2025-01-16 20:29:28 +08:00

19 lines
465 B
TypeScript

import { ClientResponseError } from "pocketbase";
import { type Statistics } from "@/domain/statistics";
import { getPocketBase } from "@/repository/pocketbase";
export const get = async () => {
const pb = getPocketBase();
const resp = await pb.send<BaseResponse<Statistics>>("/api/statistics/get", {
method: "GET",
});
if (resp.code != 0) {
throw new ClientResponseError({ status: resp.code, response: resp, data: {} });
}
return resp;
};