Skip to content

Commit

Permalink
add name to store functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Rory Doak authored and Rory Doak committed May 28, 2024
1 parent db8b354 commit 29ea716
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions editor.planx.uk/src/pages/FlowEditor/lib/store/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export interface EditorStore extends Store.Store {
connectTo: (id: Store.nodeId) => void;
copyFlow: (flowId: string) => Promise<any>;
copyNode: (id: Store.nodeId) => void;
createFlow: (teamId: any, newSlug: any) => Promise<string>;
createFlow: (teamId: any, newSlug: any, newName: string) => Promise<string>;
deleteFlow: (teamId: number, flowSlug: string) => Promise<object>;
validateAndDiffFlow: (flowId: string) => Promise<any>;
getFlows: (teamId: number) => Promise<any>;
Expand Down Expand Up @@ -186,12 +186,17 @@ export const editorStore: StateCreator<
localStorage.setItem("clipboard", id);
},

createFlow: async (teamId, newSlug) => {
createFlow: async (teamId, newSlug, newName) => {
let response = (await client.mutate({
mutation: gql`
mutation CreateFlow($data: jsonb, $slug: String, $teamId: Int) {
mutation CreateFlow(
$data: jsonb
$slug: String
$name: String
$teamId: Int
) {
insert_flows_one(
object: { slug: $slug, team_id: $teamId, version: 1 }
object: { slug: $slug, name: $name, team_id: $teamId, version: 1 }
) {
id
data
Expand All @@ -201,6 +206,7 @@ export const editorStore: StateCreator<
variables: {
slug: newSlug,
teamId,
name: newName,
},
})) as any;

Expand Down Expand Up @@ -277,6 +283,7 @@ export const editorStore: StateCreator<
where: { team: { id: { _eq: $teamId } } }
) {
id
name
slug
updated_at
operations(limit: 1, order_by: { id: desc }) {
Expand Down

0 comments on commit 29ea716

Please sign in to comment.