-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
79 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,11 +62,7 @@ export const createFlow = async (client, args) => { | |
gql` | ||
mutation InsertFlow($teamId: Int!, $slug: String!, $name: String!) { | ||
flow: insert_flows_one( | ||
object: { | ||
team_id: $teamId | ||
slug: $slug | ||
name: $name | ||
} | ||
object: { team_id: $teamId, slug: $slug, name: $name } | ||
) { | ||
id | ||
slug | ||
|
@@ -258,7 +254,9 @@ export async function getTeamAndFlowsBySlug(client, slug) { | |
} | ||
|
||
export async function getFlowBySlug(client, slug) { | ||
const {flows:[flow]} = await client.request( | ||
const { | ||
flows: [flow], | ||
} = await client.request( | ||
gql` | ||
query getFlowBySlug($slug: String) { | ||
flows(where: { slug: { _eq: $slug } }) { | ||
|
@@ -276,7 +274,7 @@ export async function getFlowBySlug(client, slug) { | |
} | ||
|
||
export async function updateFlow(client, flowId: UUID) { | ||
const {update_flows_by_pk: response} = await client.request( | ||
const { update_flows_by_pk: response } = await client.request( | ||
gql` | ||
mutation updateFlow($flowId: uuid!) { | ||
result: update_flows_by_pk( | ||
|
@@ -294,13 +292,13 @@ export async function updateFlow(client, flowId: UUID) { | |
} | ||
|
||
export async function deleteFlow(client, flowId: UUID) { | ||
const {delete_flows_by_pk: response} = await client.request( | ||
const { delete_flows_by_pk: response } = await client.request( | ||
gql` | ||
mutation MyMutation($flowId: uuid!) { | ||
delete_flows_by_pk(id: $flowId) { | ||
id | ||
} | ||
} | ||
mutation MyMutation($flowId: uuid!) { | ||
delete_flows_by_pk(id: $flowId) { | ||
id | ||
} | ||
} | ||
`, | ||
|
||
{ flowId: flowId }, | ||
|
@@ -310,28 +308,30 @@ mutation MyMutation($flowId: uuid!) { | |
|
||
export async function updateTeamSettings(client, teamId: number) { | ||
try { | ||
|
||
|
||
const {update_team_settings: response} = await client.request( | ||
gql` | ||
mutation updateTeamSettings($teamId: Int!) { | ||
update_team_settings(where: {team_id: {_eq: $teamId}}, _set: {homepage: "newpage.com", submission_email: "[email protected]"}) { | ||
returning { | ||
team_id | ||
submission_email | ||
homepage | ||
} | ||
const { update_team_settings: response } = await client.request( | ||
gql` | ||
mutation updateTeamSettings($teamId: Int!) { | ||
update_team_settings( | ||
where: { team_id: { _eq: $teamId } } | ||
_set: { | ||
homepage: "newpage.com" | ||
submission_email: "[email protected]" | ||
} | ||
) { | ||
returning { | ||
team_id | ||
submission_email | ||
homepage | ||
} | ||
} | ||
} | ||
`, | ||
{ | ||
teamId: teamId, | ||
}, | ||
); | ||
return response; | ||
} catch (error) { | ||
return false; | ||
} | ||
} | ||
`, { | ||
teamId: teamId | ||
} | ||
); | ||
return response; | ||
} catch (error) { | ||
return false | ||
} | ||
} | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters