refactor code

This commit is contained in:
MaysWind 2016-06-26 19:44:49 +08:00
parent e581a16724
commit 9c1d3b72f3
4 changed files with 6 additions and 5 deletions

View file

@ -151,7 +151,7 @@
},
"rpc": {
"error": {
"Unauthorized": "认证失败!"
"unauthorized": "认证失败!"
}
},
"options": {

View file

@ -8,7 +8,8 @@
rpcTokenPrefix: 'token:'
}).constant('aria2RpcErrors', {
Unauthorized: {
message: 'Unauthorized'
message: 'Unauthorized',
tipTextKey: 'rpc.error.unauthorized'
}
});
})();

View file

@ -155,7 +155,7 @@
},
'rpc': {
'error': {
'Unauthorized': 'Authorization Failed!'
'unauthorized': 'Authorization Failed!'
}
},
'options': {

View file

@ -71,8 +71,8 @@
return false;
}
if (error.message == aria2RpcErrors.Unauthorized.message) {
ariaNgCommonService.showError('rpc.error.' + error.message);
if (aria2RpcErrors[error.message] && aria2RpcErrors[error.message].tipTextKey) {
ariaNgCommonService.showError(aria2RpcErrors[error.message].tipTextKey);
return true;
} else {
ariaNgCommonService.showError(error.message);