feat: download certificate archive
This commit is contained in:
24
ui/src/api/certificates.ts
Normal file
24
ui/src/api/certificates.ts
Normal 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;
|
||||
};
|
||||
@@ -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,
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user