-
-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mutation for authorized users #204
Comments
@kuraiconnect is this error occurring at start time or when you attempt to execute the mutation? |
@Diizzayy at start time |
Maybe I can show this problem for find solution? |
@kuraiconnect The problem here is that the graphql codegen is lacks the proper authorization, hence it's unaware of the |
@Diizzayy thx for your answer. I try it later. Now I use module for this and do not have problem with this mutation. i add two dependencies on my project after i add this plugin on my project
and use mutation in component
and it's work for me, but I would like to use only your module later because it is very convenient and laconic |
@kuraiconnect Apologies for the delay here.
export default defineNuxtConfig({
modules: ['nuxt-graphql-client'],
runtimeConfig: {
public: {
'graphql-client': {
clients: {
default: {
host: 'https://api.spacex.land/graphql',
token: 'super_secret', // token type is bearer by default
codegenHeaders: {
'x-hasura-user-role': 'role'
}
}
}
}
}
}
}) Given the exact configuration above, the following headers would be applied to the graphql code generator: {
"Authorization": "Bearer super_secret",
"x-hasura-user-role": "role"
} |
It is not possible to add a mutation that is only available to authorized users.
I add new mutation in mutations folder
api/mutations/addSeller.gql
it will only be available to authorized users. But when i added mutation I get an error:
Cannot query field "addSeller" on type "Mutation".
i think problem with mutation because it will be available if add headers option:
how i can get access to this mutation when build my application?
The text was updated successfully, but these errors were encountered: