Focuses on API authentication, access scopes, and permission management.
Hello,
I have this function:
async function customerCreate(email: string, fName: string, lName: string){ const createCustomerInput = { "email": email, "firstName": fName, "lastName": lName, "tags": [ "{REDACTED}" ] } const createCustomerQuery = ` mutation customerCreate($input: CustomerInput!) { customerCreate(input: $input) { customer { id } userErrors { field message } } }` const {data, errors, extensions} = await client.request(createCustomerQuery, { variables: { input: createCustomerInput } }) let obj = { data, errors, extensions } return obj }
const newCustomer = await customerCreate("test@test.com", "John", "Doe")
console.log(newCustomer.data)
and then the response is
{ customerCreate: { customer: null, userErrors: [ [Object] ] } }
I don't understand why the customer is coming back null. Also, if log the userErrors property, it says undefined, and if i log the response.errors property, it also shows undefined. So i'm not getting any errors, but it's clearly not working.
Any ideas?