I'm having an error that's blowing my mind. I'm trying to mock some data in order to test my app developed with Vuex + Axios.
So...
Having these JSON files at my project's folder:
And this AJAX method:
function fetchChartsData(platform, content) {
const url = `server/chartsCollection?platform=${platform}&content=${content}.json`;
axios
.get(url)
.then(response => (console.log(response.data)))
.catch(error => console.error('fails:', error));
}
I'm getting a JSON file with:
- The correct route name
- BUT The data/content from another file
For example, the file name at Network is correct:
But the content is from another file:
It's hard to explain. There is no pattern to check with which file is changing the content. I've disabled cached as well.
Thank you!
UPDATE
If I store each file at an isolated folder... it works. I mean:
Mocked server folder:
New code:
function fetchChartsData(platform, content) {
const url = `server/${platform}/chartsCollection?platform=${platform}&content=${content}.json`;
axios
.get(url)
.then(response => (console.log(response.data)))
.catch(error => console.error('fails:', error));
}
It's fine that it works... but I'd need to have all files at the same folder to simulate the real backend environment.