lisaogren / axios-cache-adapter

Caching adapter for axios. Store request results in a configurable store to prevent unneeded network requests.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Invalidate on response

taily-khucnaykhongquantrong opened this issue · comments

commented

My server API doesn't return 400 - 500 response code to throw error. They use a specific response with structure such as { err: number; msg: string } with 200 response code. I could use axios interceptor to throw error, but that would not be cached. That's why invalidate on response is really important to me.
PS: I'm not using GraphQL.

I had the same problem. found a better library where you can use a predicate to check if the request should be cached.
https://github.com/arthurfiorette/axios-cache-interceptor#requestcachecachepredicate