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

on refresh its hitting backend api for data #24

Open
ErBahuguna opened this issue Feb 24, 2018 · 1 comment
Open

on refresh its hitting backend api for data #24

ErBahuguna opened this issue Feb 24, 2018 · 1 comment

Comments

@ErBahuguna
Copy link

I am using cachios in vuejs

import axios from 'axios';
import cachios from 'cachios';

cachios.getResponseCopy = function (response) {
console.log(['cachiosInstance',response]);
return {
status: response.status,
statusText: response.statusText,
data: response.data,
};
};

cachios.getCacheIdentifier = function (config) {
console.log(['getCacheIdentifier',config]);
return {
method: config.method,
url: config.url,
params: config.params,
data: config.data,
headers: config.headers,
};
};

this.requestAuthHeader={ headers:
{
'Content-Type': 'application/json',
'Authorization': ${access_token}
},
ttl: 180, // persist this result for 3 minutes
};

cachios.get(url,this.requestAuthHeader);

but when i refresh the page it still hit the backend api as i am setting 3 minutes for cache expire time.

@ggedde
Copy link

ggedde commented May 22, 2018

Yeah, same for me. I see the cached item when inspecting the cachios object, but it is still hitting the URL to get the json data. My expectations would be that it wouldn't.

I just did a fresh install and using Nuxt and Cachios and still get the issue.

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

No branches or pull requests

3 participants