Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New data provider ra-strapi-rest added to DataProviders.md #2796

Merged
merged 1 commit into from
Jan 28, 2019

Conversation

nazirov91
Copy link
Contributor

No description provided.

@Kmaschta
Copy link
Contributor

Hey! Thanks for the contribution, your data provider seems great!

I see that you have copy/pasted the code of ra-data-simple-rest in order to write your own provider.
May I suggest you to take ra-data-simple-rest and wrap it in order to adjust it for Strapi?

See the documentation about that: https://marmelab.com/react-admin/DataProviders.html#decorating-your-data-provider-example-of-file-upload

@Kmaschta Kmaschta self-assigned this Jan 21, 2019
@nazirov91
Copy link
Contributor Author

Thank you for the suggestion! What would be the best way to access the apiUrl when wrapping the ra-data-simple-rest ?

@Kmaschta
Copy link
Contributor

Kmaschta commented Jan 24, 2019

You can update it before to call the simple rest provider, with something like:

const customProvider = (apiUrl) => (type, resource, params) => {
    const modifiedUrl = `${apiUrl}/prod`;

    return simpleRestDataProvider(modifiedUrl)(type, resource, params)
        .then((result) => /* update result */);
};

EDIT: I approve since the change in code will not affect library users.

@Kmaschta Kmaschta removed their assignment Jan 28, 2019
@djhi djhi modified the milestones: 2.7.0, v2.6.4 Jan 28, 2019
@djhi djhi merged commit be902ec into marmelab:master Jan 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants