i'm new to Vue js and i created my first project using Node JS APIs and it's working good but a bit slow when multiple request achieve so i created a cache for each API but as i can see it cached data for short period of time and then i need to wait again and when cached it's not really fast, below i created an API.js folder and i stored all my API calls in it.. is there a way to achieve cache best practice in Vue js? thanks in advance
import axios from 'axios'
import { cacheAdapterEnhancer } from 'axios-extensions';
const http = axios.create({
baseURL: 'https://******.herokuapp.com/',
headers: { 'Cache-Control': 'no-cache' },
// cache will be enabled by default
adapter: cacheAdapterEnhancer(axios.defaults.adapter)
});
class BuildingsService {
getBuildings(){
return http.get('buildings/api/');
}
getFlats(id){
return http.get(`flats/api/${id}`);
}
notifications(){
return http.get('notifications/api/');
}
getOneBuilding(id){
return http.get(`buildings/api/${id}`)
}
getAllFlats(){
return http.get(flats/api/')
}
}
export default new BuildingsService();