1/** 2 * ÐÑкÑ-оÑвеÑ, пÑÐ¸Ñ Ð¾Ð´ÑÑий Ð¾Ñ ÑеÑвеÑа 3 * 4 * @param response 5 * @constructor 6 */ 7var ServerAjaxResponse = function (response) { 8 this.response = response.data; 9}; 10 11/** 12 * @returns {boolean} 13 */ 14ServerAjaxResponse.prototype.isSuccess = function () { 15 return this.response && !!this.response.success; 16}; 17 18/** 19 * @returns {boolean} 20 */ 21ServerAjaxResponse.prototype.isRedirectResponse = function () { 22 return this.response && !!this.response.redirect; 23}; 24 25/** 26 * @returns {boolean} 27 */ 28ServerAjaxResponse.prototype.hasErrors = function () { 29 return Object.keys(this.getErrors()).length > 0; 30}; 31 32/** 33 * @returns {{errorCode: string|array errorMsg}} 34 */ 35ServerAjaxResponse.prototype.getErrors = function () { 36 if (!this.response) { 37 return {}; 38 } 39 return this.response.errors || {}; 40}; 41 42/** 43 * @returns {{errorCode: string|array errorMsg}} 44 */ 45ServerAjaxResponse.prototype.getPayload = function () { 46 if (!this.response) { 47 return {}; 48 } 49 return this.response.payload || {}; 50}; 51 52/** 53 * ÐолÑÑÐ°ÐµÑ ÑпиÑок оÑибок Ñ Ð¸Ð·Ð¼ÐµÐ½ÐµÐ½Ð½Ñми клÑÑами. 54 * ÐапÑÐ¸Ð¼ÐµÑ ÑÑÐ¾Ð±Ñ Ð¿ÐµÑевеÑÑи ÑпиÑок оÑибок {EMAIL: 'невеÑнÑй email'} к Ð²Ð¸Ð´Ñ {email: 'невеÑнÑй email'} 55 * ÑледÑÐµÑ Ð²ÑзваÑÑ ÑÑÐ¾Ñ Ð¼ÐµÑод Ñ Ð¿Ð°ÑамеÑÑом {EMAIL: 'email'} 56 * 57 * @param keysMap 58 */ 59ServerAjaxResponse.prototype.getErrorsWithMappedKeys = function (keysMap) { 60 var result = {}; 61 62 var errors = this.getErrors(); 63 Object.keys(errors).forEach(function (key) { 64 result[keysMap[key] || key] = errors[key]; 65 }); 66 67 return result; 68}; 69 70/** 71 * @returns {Array} ÑпиÑок дополниÑелÑнÑÑ ÑообÑений 72 */ 73ServerAjaxResponse.prototype.getNotifyMessages = function () { 74 if (!this.response) { 75 return []; 76 } 77 return this.response.notifyMessages || []; 78}; 79 80/** 81 * @returns {string} URL Ð´Ð»Ñ ÑедиÑекÑа 82 */ 83ServerAjaxResponse.prototype.getRedirectUrl = function () { 84 if (!this.response) { 85 return ''; 86 } 87 return this.response.redirect || ''; 88};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.