certimate/ui/src/api/notify.ts
2025-01-18 07:09:41 +08:00

24 lines
517 B
TypeScript

import { ClientResponseError } from "pocketbase";
import { getPocketBase } from "@/repository/_pocketbase";
export const notifyTest = async (channel: string) => {
const pb = getPocketBase();
const resp = await pb.send<BaseResponse>("/api/notify/test", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: {
channel,
},
});
if (resp.code != 0) {
throw new ClientResponseError({ status: resp.code, response: resp, data: {} });
}
return resp;
};