Add flow update to database
This commit is contained in:
parent
2fb72b1d1e
commit
7912f846a6
1 changed files with 11 additions and 0 deletions
|
|
@ -9,6 +9,7 @@ import {
|
||||||
applyNodeChanges,
|
applyNodeChanges,
|
||||||
} from "reactflow";
|
} from "reactflow";
|
||||||
import { create } from "zustand";
|
import { create } from "zustand";
|
||||||
|
import { updateFlowInDatabase } from "../controllers/API";
|
||||||
import {
|
import {
|
||||||
NodeDataType,
|
NodeDataType,
|
||||||
NodeType,
|
NodeType,
|
||||||
|
|
@ -344,6 +345,16 @@ const useFlowStore = create<FlowStoreType>((set, get) => ({
|
||||||
function handleBuildUpdate(data: any) {
|
function handleBuildUpdate(data: any) {
|
||||||
get().addDataToFlowPool(data.data[data.id], data.id);
|
get().addDataToFlowPool(data.data[data.id], data.id);
|
||||||
}
|
}
|
||||||
|
await updateFlowInDatabase({
|
||||||
|
data: {
|
||||||
|
nodes: get().nodes,
|
||||||
|
edges: get().edges,
|
||||||
|
viewport: get().reactFlowInstance?.getViewport()!,
|
||||||
|
},
|
||||||
|
id: currentFlow!.id,
|
||||||
|
name: currentFlow!.name,
|
||||||
|
description: currentFlow!.description,
|
||||||
|
});
|
||||||
return buildVertices({
|
return buildVertices({
|
||||||
flowId: currentFlow!.id,
|
flowId: currentFlow!.id,
|
||||||
nodeId,
|
nodeId,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue