对接接口对错误的处理

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接: https://blog.csdn.net/Hei_lovely_cat/article/details/102698781
if (response.data.code == 0) {  
this.store.dispatch("setdeviceId", deviceId);    
this.getEquipmentList();                            
this.$message.success("切换成功!");                        
} else if (response.data.code !== 0) {                            
if (response.data.code == 401 || response.data.code == 4011) 
{                                
this.$message.error("登录超时,请重新登录!");                                
this.$router.push({                                    
path: "/"                                
});                            
} else if (response.data.code == 4012) {                   
this.$message.error("您的账号已在另一台设备登录,如非本人操作请及时修改密码!");                                
this.$router.push({                                    
path: "/"                                
});                            
} else {                                
this.$message.error(response.data.msg);        
}                       
 }

猜你喜欢

转载自blog.csdn.net/Hei_lovely_cat/article/details/102698781