feat(ui): subscribe workflow runs status
This commit is contained in:
@@ -50,13 +50,9 @@ export const remove = async (record: MaybeModelRecordWithId<WorkflowModel>) => {
|
||||
};
|
||||
|
||||
export const subscribe = async (id: string, cb: (e: RecordSubscription<WorkflowModel>) => void) => {
|
||||
const pb = getPocketBase();
|
||||
|
||||
return pb.collection("workflow").subscribe(id, cb);
|
||||
return getPocketBase().collection(COLLECTION_NAME).subscribe(id, cb);
|
||||
};
|
||||
|
||||
export const unsubscribe = async (id: string) => {
|
||||
const pb = getPocketBase();
|
||||
|
||||
return pb.collection("workflow").unsubscribe(id);
|
||||
return getPocketBase().collection(COLLECTION_NAME).unsubscribe(id);
|
||||
};
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import { type WorkflowRunModel } from "@/domain/workflowRun";
|
||||
import { type RecordSubscription } from "pocketbase";
|
||||
|
||||
import { type WorkflowRunModel } from "@/domain/workflowRun";
|
||||
|
||||
import { getPocketBase } from "./_pocketbase";
|
||||
|
||||
@@ -35,3 +37,11 @@ export const list = async (request: ListWorkflowRunsRequest) => {
|
||||
export const remove = async (record: MaybeModelRecordWithId<WorkflowRunModel>) => {
|
||||
return await getPocketBase().collection(COLLECTION_NAME).delete(record.id);
|
||||
};
|
||||
|
||||
export const subscribe = async (id: string, cb: (e: RecordSubscription<WorkflowRunModel>) => void) => {
|
||||
return getPocketBase().collection(COLLECTION_NAME).subscribe(id, cb);
|
||||
};
|
||||
|
||||
export const unsubscribe = async (id: string) => {
|
||||
return getPocketBase().collection(COLLECTION_NAME).unsubscribe(id);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user