We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Author avatar is always null in Graphql Queries. It only works with the API call after passing the populate /flat?populate[author][populate][0]=avatar
/flat?populate[author][populate][0]=avatar
The text was updated successfully, but these errors were encountered:
REST is fine, you can try
Sorry, something went wrong.
but Graphql is better, how to do it?
you just need to extend the response, create a field and resolve, in index.js
const extensionService = strapi.plugin("graphql").service("extension"); extensionService.use(({ nexus }) => ({ types: [ nexus.extendType({ type: "CommentSingle", definition(t) { t.string("authorFull", { type: "UsersPermissionsUserEntityResponse", description: "Author full data", resolve: async (parent, root, args) => { const { toEntityResponse } = strapi.service( "plugin::graphql.format" ).returnTypes; console.log("parent", parent.author.id); const user = await strapi.db .query("plugin::users-permissions.user") .findOne({ where: { id: parent.author.id }, populate: { profile_image: true }, }); console.log("user", user); return toEntityResponse(user); }, }); }, }), ],
mkmak2
No branches or pull requests
Author avatar is always null in Graphql Queries. It only works with the API call after passing the populate
/flat?populate[author][populate][0]=avatar
The text was updated successfully, but these errors were encountered: