refactor(04 flow): type and create function

This commit is contained in:
puriphatt 2024-10-25 15:23:09 +07:00
parent 6f887edd42
commit b0cb6061af
2 changed files with 8 additions and 0 deletions

View file

@ -32,6 +32,12 @@ export const useWorkflowTemplate = defineStore('workkflow-store', () => {
return res.data;
}
async function creatWorkflowTemplate(data: WorkflowTemplatePayload) {
const res = await api.post<WorkflowTemplate>('/workflow-template', data);
if (res.status >= 400) return null;
return res;
}
async function editWorkflowTemplate(
data: WorkflowTemplatePayload & { id: string },
) {
@ -60,6 +66,7 @@ export const useWorkflowTemplate = defineStore('workkflow-store', () => {
getWorkflowTemplate,
getWorkflowTemplateList,
creatWorkflowTemplate,
editWorkflowTemplate,
deleteWorkflowTemplate,
};

View file

@ -29,6 +29,7 @@ export type WorkflowTemplate = {
};
export type WorkflowTemplatePayload = {
registeredBranchId?: string;
name: string;
step: {
name: string;