blob: 28146b50b1084d0af2912a2a0c8c2e70720a59b7 [file] [log] [blame]
(function () {
'use strict';
angular.module('xos.UITutorial')
.service('ResponseHandler', function(){
this.parse = (res, done) => {
// TODO @Arpit format res (it can be an array or an object),
// it is better if the output is a valid JSON (that we can copy and paste)
// TODO handle 204/No-Content response
if(angular.isArray(res)){
res = res.map(i => {
return JSON.stringify(i, ['id', 'name', 'max_instances'], 2) + '<br/>';
});
}
else {
res = JSON.stringify(res, ['id', 'name', 'max_instances'], 2);
}
done(res);
};
});
})();