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

All methods are cached #140

Open
paradoxxxzero opened this issue May 5, 2017 · 7 comments
Open

All methods are cached #140

paradoxxxzero opened this issue May 5, 2017 · 7 comments
Labels

Comments

@paradoxxxzero
Copy link

PUT, POST, DELETE methods aren't executed when cache is enabled (and a previous request has been made within the cache window)

This is really problematic, only GET methods should be cached.
I think something like this should fix it:

 const cacheManager = params.method === 'GET' && getCacheManager(options.expire, meta.cache);

https://github.com/lexich/redux-api/blob/master/src/actionFn.js#L59

Otherwise the cache works fine now (#135)

@lexich lexich added the bug label May 5, 2017
@lexich
Copy link
Owner

lexich commented May 5, 2017

Yes, I think that you are right, but I don't think that fix should be so simple :)

@paradoxxxzero
Copy link
Author

Well, I tried :)

On a side note I have another problem: I can't PUT 2 elements simultaneously due to this line https://github.com/lexich/redux-api/blob/master/src/actionFn.js#L132 the second gets ignored.
Is there any workaround?

@lexich
Copy link
Owner

lexich commented May 5, 2017

You can't do this if you control state. But if you need put without update state (2 simultaneously request) you shoud use request method. It's simple request without redux wrappers

@paradoxxxzero
Copy link
Author

Yes you're right thanks !

@ianloubser
Copy link

Having the same issue.
Has this been resolved? or is there a simple workaround?

@lexich
Copy link
Owner

lexich commented Feb 27, 2019

@ianloubser use .request method and control state manually

@ianloubser
Copy link

ianloubser commented Feb 27, 2019

Sorry I meant for the cached POST, PUT and DELETE methods.
The original issue described here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants