0

i have override "revokeCustomerToken" mutation & tried to add input "page data" to it, but it seems "revokeCustomerToken" does not support input attributes

https://devdocs.magento.com/guides/v2.4/graphql/mutations/revoke-customer-token.html.

Is their any way we can pass some data in "revokeCustomerToken" mutation ?

like

mutation {
  revokeCustomerToken {
    result
    pagedata
  }
}

I doubt it does not support input parameters.

Any thoughts on this ?

1
  • Any thoughts on this ?
    – devhs
    Commented Mar 18, 2021 at 6:38

1 Answer 1

0

I am not sure what code you did till now. But I can suggest you the way to achieve your requirements.

You need to create one custom module in order to overwrite this mutation. In your custom module you need to create schema file named as "schema.graphqls" under etc folder.

In this file you can write like below:

type RevokeCustomerTokenOutput {
    pagedata:PageData @resolver (class: "\\Hello\\World\\Model\\Resolver\\Customer\\PageDataResolver") @doc(description:"Pagedata for respective customer.")    
}

Further, you need to create PageDataResolver.php at specified path to return the relevant data.

I hope this helps you. Let me know if you have any query further.

Happy to help always!

6
  • Hello pratik, i am not much sure if there will be another resolver for pagedata input, i guess there should be only one resolver for one mutation.
    – devhs
    Commented Mar 18, 2021 at 6:08
  • pagedata: { location: "test" login_type: "test" page_path: "[email protected]" page_referrer: "test" page_title: "test" page_url: "test" } this is i would like to pass with page data is that possible with this ? Thanks for the reply
    – devhs
    Commented Mar 18, 2021 at 6:08
  • I got this error - (GraphQL\Error\Error): Type "PageData" not found in document.
    – devhs
    Commented Mar 18, 2021 at 6:09
  • If you don't want to create another resolver for pagedata then you can use the one which is defined by magento for result. Then you need to overwrite that resolver in order to access the pagedata field and write your business logic. Commented Mar 18, 2021 at 6:19
  • Thanks, can you please advise me about the schema so i can run it in chrome graphql tool and check if its working ? I had tried with below mutation { revokeCustomerToken ( result: "true" pagedata { page_path : 'login' } ) }
    – devhs
    Commented Mar 18, 2021 at 6:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.