大佬教程收集整理的这篇文章主要介绍了如何修复导致未定义错误的属性“状态”的 Axios 拦截器,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我可以选择将元素的权限设置为全局或私有。我正在使用 Axios 拦截器请求来处理查找权限字段以获取数据,如果有,则对其进行字符串化。问题是,当我尝试重新加载程序时,它会导致我收到“类型错误:无法读取未定义的属性‘状态’”。现在唯一的“修复”是注销,移除拦截器,登录,阅读,然后再次运行检查。
因此,我什至无法进入该软件的主页仪表板。如果我清除了 cookie,我可以返回登录屏幕,但在尝试登录后不能再返回。
有什么我想念的吗?下面是拦截器代码。如果需要更多信息或上下文,请告诉我。
export default { install: (VuE) => { Vue.$eventBus = new Vue(); Vue.axios.interceptors.response.use(response => { return response.data; },async error => { if (error.response.status === 401 && error.config.url != '/API/authentication/login') { var config = await Vue.$configservice.find(); window.LOCATIOn = config.accountportalUrl; return } console.log(error); Vue.$eventBus.$emit('notifyUser','Uh oh,something went wrong!'); return Promise.reject(error); }); Vue.axios.interceptors.request.use( config => { // check request method -> use post if many params if (config.data.permissions) { config.data.permissions = JsON.Stringify(config.data.permissions); } console.log(config); return config; } ); } };
@H_944_11@解决方法
您的服务 API 似乎没有响应,如果用户未通过身份验证,则可能会发生这种情况。您的错误位于您检查的行(error.response.status)。当请求在响应之前被中断时,它只能得到一个未定义的响应。很可能如果您检查浏览器网络面板,您会看到此请求的预检检查导致 401 网络错误。因此,由于预检失败,您的实际响应未定义。您应该首先检查您的服务器是否响应响应,然后访问响应状态。
这样的事情可能会有所帮助
Sub updateFiles() Dim rownum As Long rownum = 2 Dim last_row As Long last_row = Cells(Rows.Count,1).End(xlUp).Row Dim filename As String Dim newvalue As Long For nextRow = 2 To last_row filename = Range("A" & ROWNUM).Value newvalue = ActiveWorkbook.Sheets("Sheet1").Range("B" & ROWNUM).Value Workbooks.Open "C:\Folder\" & filename ActiveWorkbook.Unprotect ("password") ActiveWorkbook.Sheets("References").Range("F2") = newvalue ActiveWorkbook.Protect ("password") ActiveWorkbook.Save ActiveWorkbook.Close rownum = rownum + 1 Next nextRow End Sub
@H_944_11@ ,所以,答案最终非常简单。
if (config.data.permissions)
@H_944_11@必须
if (config.data && config.data.permissions)
@H_944_11@大佬总结
以上是大佬教程为你收集整理的如何修复导致未定义错误的属性“状态”的 Axios 拦截器全部内容,希望文章能够帮你解决如何修复导致未定义错误的属性“状态”的 Axios 拦截器所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。