久久r热视频,国产午夜精品一区二区三区视频,亚洲精品自拍偷拍,欧美日韩精品二区

您的位置:首頁技術(shù)文章
文章詳情頁

javascript - axios錯(cuò)誤處理的對(duì)象error.response 是空

瀏覽:94日期:2022-11-10 16:38:31

問題描述

_this.$http.post(`/company/${id}/out`, { access_token: _this.access_token,}).then((res) => { let info = res;}).catch((err) => { console.log(err.response); // err.response 是 undefined})},

javascript - axios錯(cuò)誤處理的對(duì)象error.response 是空

我想在 403 或者 401 的時(shí)候去處理這個(gè)錯(cuò)誤,但是拿不到這個(gè)狀態(tài)碼。但是官網(wǎng)上就是這么用的。

axios.get(’/user/12345’) .catch(function (error) { if (error.response) { // The request was made and the server responded with a status code // that falls out of the range of 2xx console.log(error.response.data); console.log(error.response.status); console.log(error.response.headers); } else if (error.request) { // The request was made but no response was received // `error.request` is an instance of XMLHttpRequest in the browser and an instance of // http.ClientRequest in node.js console.log(error.request); } else { // Something happened in setting up the request that triggered an Error console.log(’Error’, error.message); } console.log(error.config); });

我的axios 的版本是 ^0.16.1。

問題解答

回答1:

403不清楚,但是我記得之前我查的答案是401會(huì)被瀏覽器攔截處理掉,js拿不到

標(biāo)簽: JavaScript
相關(guān)文章:
主站蜘蛛池模板: 西乌珠穆沁旗| 临西县| 莱州市| 和田市| 汾阳市| 峨山| 兴城市| 新邵县| 金沙县| 奉贤区| 屏东市| 宁津县| 河津市| 龙门县| 漳平市| 集安市| 云阳县| 怀远县| 旅游| 江安县| 得荣县| 哈巴河县| 阿鲁科尔沁旗| 肇庆市| 和政县| 竹溪县| 仁化县| 肇东市| 大同县| 志丹县| 望都县| 开远市| 通河县| 商洛市| 屯留县| 上饶市| 沅江市| 修文县| 沙田区| 历史| 洪雅县|