MrHertal / react-admin-amplify

AWS Amplify data provider for react-admin.
MIT License
159 stars 42 forks source link

export data and auth providers #61

Open deniszatsepin opened 3 years ago

deniszatsepin commented 3 years ago

Hi guys, thanks for this great extension for ReactAdmin. I want to suggest a small improvement. Currently, it's not possible to extend providers (and we need to have some custom mutations). We have types of DataProvider and AuthProvider but there is no JavaScript exported for these classes. Thank you!

MrHertal commented 3 years ago

Hi @deniszatsepin, thanks for the suggestion.

I have a question though: why not using buildAuthProvider and buildDataProvider in order to get the providers and then extend them following react-admin documentation?

deniszatsepin commented 3 years ago

Hi @MrHertal, thanks for your response.

I've tried to use buildDataProvider and extend it as a first step, but it didn't work out in my case. I need to have a custom graphql call - approveResource. In buildDataProvider, only a subset of methods is exported and it does not allow access to the DataProvider class itself. So, I can't introduce a new method and call public graphql() of the DataProvider, because I don't have this linked to the DataProvider class instance. Probably there is another way to achieve what I need.