blob: 42af90bfa5d02fb9acb59f218ac446a8d2dc4013 [file] [log] [blame]
(function() {
'use strict';
angular.module('xos.helpers')
/**
* @ngdoc service
* @name xos.helpers.Dashboards
* @description Angular resource to fetch /api/core/dashboardviews/:id/
**/
.service('Dashboards', function($resource, $q, $http){
const r = $resource('/api/core/dashboardviews/:id/', { id: '@id' }, {
update: { method: 'PUT' }
});
r.prototype.$save = function(){
const d = $q.defer();
$http.put(`/api/core/dashboardviews/${this.id}/`, this)
.then((res) => {
d.resolve(res.data);
})
.catch(e => {
d.reject(e.data);
});
return d.promise;
}
return r;
})
})();