Reduction
Last updated
Query {
root: ({ context }) => Root {
showNewEditor: ({}) =>
if (
context.user.id in ["user_123", "user_456"] AND
context.user.email endsWith "@test.com"
) {
true
} else {
false
}
}
}query TestQuery {
root(
context: {
user: {
id: "user_123"
name: "Test"
email: "test@test.com"
}
}
) {
showNewEditor
}
}Query {
root: Root {
showNewEditor: true
}
}{
"__typename": "Query",
"root": {
"__typename": "Root",
"showNewEditor": false
}
}query TestQuery {
root(
context: {
user: {
id: "user_123"
}
}
) {
showNewEditor
}
}Query {
root: ({ context }) => Root {
showNewEditor: ({}) =>
if (true AND context.user.email endsWith "@test.com") {
true
} else {
false
}
}
}