axios.post('http://localhost:8888/task/findAllTask', {token: token})
      .then(response => {
        this.taskList = response.data;
        this.nextId = response.data.length;
      })
      .catch(error => {
        console.log(error);
      });

Explanation:

In the original code, the token was passed as a parameter to the post request, but it needs to be passed as data in the request body. So, we need to modify the code to pass the token as an object with the key 'token' and value as the token variable. This can be done by passing an object with the key-value pair {token: token} as the second parameter to the axios.post() method.
Axios POST Request: Sending Token in Request Body

原文地址: https://www.cveoy.top/t/topic/msQm 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录