System Information
- Strapi Version: 4.1.0
- Operating System: Mac OSX
- Database: Postgres
- Node Version: 16.13.2
- NPM Version: 8.4.0
- Yarn Version:
So I’ve read almost every forum post and discord post, and still can’t get the answer. I need a custom resolver, which I believe I’ve done. However, I can’t get the proper graphql response.
register: ({ strapi }) => {
const extensionService = strapi.plugin("graphql").service("extension");
const extension = ({ nexus }) => ({
types: [
nexus.extendType({
type: "Mutation",
definition: (t) => {
t.field("createCustomerProfile", {
type: "CustomerProfileEntityResponse",
args: { data: "CustomerProfileInput" },
async resolve(parent, args) {
const date = new Date();
const month = ("0" + (date.getMonth() + 1)).slice(-2);
const year = date.getFullYear();
const twoDigitYear = year.toString().substring(2)
args.data.uid = uniqid.time(`${month}-${twoDigitYear}-`)
const data = await strapi.entityService.create('api::customer-profile.customer-profile',args)
console.log(data)
return data
},
});
}
}),
]
});
extensionService.use(extension);
},
However, that response, is just a simple JSON, and not a GraphQL response. Please help!!