feat: download certificate archive

This commit is contained in:
Fu Diwei
2025-01-18 07:07:50 +08:00
parent d28b89f03e
commit d5e4ea385d
16 changed files with 265 additions and 139 deletions

View File

@@ -0,0 +1,24 @@
import { ClientResponseError } from "pocketbase";
import { type CertificateFormatType } from "@/domain/certificate";
import { getPocketBase } from "@/repository/_pocketbase";
export const archive = async (id: string, format?: CertificateFormatType) => {
const pb = getPocketBase();
const resp = await pb.send<BaseResponse>(`/api/certificates/${encodeURIComponent(id)}/archive`, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: {
format: format,
},
});
if (resp.code != 0) {
throw new ClientResponseError({ status: resp.code, response: resp, data: {} });
}
return resp;
};

View File

@@ -6,13 +6,12 @@ import { getPocketBase } from "@/repository/_pocketbase";
export const run = async (id: string) => {
const pb = getPocketBase();
const resp = await pb.send<BaseResponse>("/api/workflow/run", {
const resp = await pb.send<BaseResponse>(`/api/workflows/${encodeURIComponent(id)}/run`, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: {
workflowId: id,
trigger: WORKFLOW_TRIGGERS.MANUAL,
},
});