Added: Password change plugin API improvements (#910)

This commit is contained in:
RainLoop Team 2015-12-15 07:02:30 +03:00
parent b97bd4edf0
commit cfad4bb005
11 changed files with 107 additions and 18 deletions

View file

@ -233,11 +233,23 @@ class Translator
return message;
}
defCode = defCode ? (window.parseInt(defCode, 10)) || 0 : 0;
return _.isUndefined(this.notificationI18N[code]) ? (
defCode && _.isUndefined(this.notificationI18N[defCode]) ? this.notificationI18N[defCode] : ''
) : this.notificationI18N[code];
}
/**
* @param {object} response
* @param {number} defCode = Notification.UnknownNotification
* @return {string}
*/
getNotificationFromResponse(response, defCode = Notification.UnknownNotification) {
return response && response.ErrorCode ?
this.getNotification(Utils.pInt(response.ErrorCode), response.ErrorMessage || '') :
this.getNotification(defCode);
}
/**
* @param {*} code
* @return {string}