axios请求嵌套同步方法

axios请求嵌套同步方法

axios.get('/userAll')
  .then( async response {
    console.log(response);
    //要同步这个方法
    await  axios.get('/user?ID=12345')
      .then(function (response) {
        console.log(response);
      })
      .catch(function (error) {
        console.log(error);
      });
  })
  .catch(function (error) {
    console.log(error);
  });
posted @ 2022-10-24 20:56  享受生活2023  阅读(250)  评论(0编辑  收藏  举报