0👍
I checked your project and I found the error.
async addTask(context, data) {
const res = await fetch('https://jsonplaceholder.typicode.com/todos', {
method: 'POST',
headers: {
'Content-Type': 'appication/json;charset=utf-8',
},
body: JSON.stringify(data),
});
if (res.ok) {
let result = await res.json();
context.dispatch('getTasks');
}
return res.ok;
},
When you call API, Backend doesn’t add newTask, This is error.
So when you get response, there isn’t newTask data that you added.
- [Vuejs]-Vue 3 Typescript – template suggestions / autocomplete
- [Vuejs]-Why does my webpage refresh when I execute the "save" function in Django?
Source:stackexchange.com