jsonplaceholder icon indicating copy to clipboard operation
jsonplaceholder copied to clipboard

Similar Issue to earlier this month, the CORS policy does not return a simple get request via axios api

Open tomit4 opened this issue 3 years ago • 0 comments

Hi, I'm following a basic tutorial on Brad Traversy's youtube channel using vuex, but where I call an axios request to the todos db with a limit parameter I get this error message:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://jsonplaceholder/typicode.com/todos?_limit=20. (Reason: CORS request did not succeed).

The axios call in particular is here:

`` async filterTodos({ commit }, e) { const limit = parseInt(e.target.options[e.target.options.selectedIndex].innerText);

    const response = await axios.get(`https://jsonplaceholder/typicode.com/todos?_limit=${limit}`);

    commit("setTodos", response.data);
}

It could be because I'm new to coding, but from what I've gathered a similar issue was brought up earlier this month, so I thought I'd put this forward.

tomit4 avatar Jul 22 '21 20:07 tomit4