Skip to content

Commit

Permalink
Use keystone.executeGraphQL in starter project (keystonejs#3161)
Browse files Browse the repository at this point in the history
  • Loading branch information
timleslie authored Jun 17, 2020
1 parent 0bf9e06 commit 89fb78d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
5 changes: 5 additions & 0 deletions .changeset/swift-baboons-cough.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'create-keystone-app': patch
---

Updated to use `keystone.executeGraphQL` for all server-side GraphQL operations.
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,26 @@ module.exports = async keystone => {
data: {
_allUsersMeta: { count },
},
} = await keystone.executeQuery(
`query {
} = await keystone.executeGraphQL({
query: `query {
_allUsersMeta {
count
}
}`
);
}`,
});

if (count === 0) {
const password = randomString();
const email = '[email protected]';

await keystone.executeQuery(
`mutation initialUser($password: String, $email: String) {
await keystone.executeGraphQL({
query: `mutation initialUser($password: String, $email: String) {
createUser(data: {name: "Admin", email: $email, isAdmin: true, password: $password}) {
id
}
}`,
{
variables: {
password,
email,
},
}
);
variables: { password, email },
});

console.log(`
Expand Down

0 comments on commit 89fb78d

Please sign in to comment.