chore: workflow sync with hash (#4250)

This commit is contained in:
zxhlyh
2024-05-10 14:48:20 +08:00
committed by GitHub
parent f49c99937c
commit a1ab87107b
8 changed files with 74 additions and 22 deletions

View File

@@ -9,12 +9,12 @@ import type {
} from '@/types/workflow'
import type { BlockEnum } from '@/app/components/workflow/types'
export const fetchWorkflowDraft: Fetcher<FetchWorkflowDraftResponse, string> = (url) => {
return get<FetchWorkflowDraftResponse>(url, {}, { silent: true })
export const fetchWorkflowDraft = (url: string) => {
return get(url, {}, { silent: true }) as Promise<FetchWorkflowDraftResponse>
}
export const syncWorkflowDraft = ({ url, params }: { url: string; params: Pick<FetchWorkflowDraftResponse, 'graph' | 'features'> }) => {
return post<CommonResponse & { updated_at: number }>(url, { body: params })
return post<CommonResponse & { updated_at: number; hash: string }>(url, { body: params }, { silent: true })
}
export const fetchNodesDefaultConfigs: Fetcher<NodesDefaultConfigsResponse, string> = (url) => {