I have a vue app where I am toggling the width of a sidebar menu. My plan is to have a UI object in a local apollo cache where i can keep track of various UI states (ex. sidebar open vs. closed). I have a query to check the state of the sidebar and a mutation to update it. But for some reason the mutation seems to require that i give it parameters ($id: ID), even though I'm not actually passing anything to the mutation when I use it. How should i write the mutation when i'm not using any parameters? Or is a parameter required? Attempts at removing parameters and corresponding error messages below.
Removing parameters from both like so (Attempt #1):
Results in:
Removing parenthesis like so (Attempt #2):
Results in:
When querying a field without any arguments, you should omit parentheses. In other words, you would just do
toggleSidebar
instead of
toggleSidebar()
The latter is not valid syntax in GraphQL.