MrHertal/react-admin-amplify

Over-riding creation mutation

PeteLatham-CothamTechnologies opened this issue · 2 comments

I have a react-admin resource of "users". For various reasons, my back-end is using both Cognito and DynamoDB to manage users. react-admin-amplify connects nicely to my Amplify backend and lists the users from the database table as I would expect.

I have created a custom mutation that has a lambda resolver which creates the Cognito user account, gets its sub value and then calls the standard CreateUser mutation to create the database record.

How can I have react-amplify-admin call a mutation other than the expected "CreateUser"?

Thanks ... Pete

Hi,

Does your custom mutation have exactly the same arguments as the standard CreateUser, and returns exactly the same output?

If it's the case, you can simply replace the CreateUser mutation by your custom mutation in mutations.js.

If it's not, I think you will have to create a new route in react-admin in order to call your custom resolver manually.
I can give you code sample if you want.