Commit c2d39cdb authored by Leonardo Piccioni de Almeida's avatar Leonardo Piccioni de Almeida
Browse files

Remove redundant OPTIONS request.

parent 5d47f2a8
......@@ -80,21 +80,6 @@
};
}]);
/**
* Give a function that send _method=OPTIONS to django rest_framework
* URL informed and return a promise with result.
*/
app.factory('getRestOptions', ['$http', function($http){
return function(url){
return $http({
method:'POST',
url: url,
data:'_method=OPTIONS',
headers:{'Content-Type':'application/x-www-form-urlencoded'}
});
};
}]);
/**
* Provide a Course Professor class. The property Class.fields contains the
......@@ -128,7 +113,7 @@
* Provide a Course class. The property Class.fields contains the
* list of fields that reflects Course model in Django
*/
app.factory('Course', ['$resource', 'getRestOptions', function($resource, getRestOptions) {
app.factory('Course', ['$resource', function($resource) {
var Course = $resource(BASE_API_URL + '/api/course/:id', {'id':'@id'});
Course.prototype.isDraft = function() { return this.status === 'draft'; };
......@@ -149,11 +134,6 @@
return this.$save();
};
getRestOptions(BASE_API_URL + '/course').success(function(data) {
Course.fields = angular.copy(data.actions.POST);
});
return Course;
}]);
......
......@@ -75,9 +75,6 @@
var messages = [];
for(var att in response.data) {
var message = response.data[att];
if(Course.fields && Course.fields[att]) {
message = Course.fields[att].label + ': ' + message;
}
messages.push(message);
}
$scope.alert.error('Encontramos alguns erros!', messages, true);
......
......@@ -150,10 +150,6 @@
};
getRestOptions(BASE_API_URL + '/course').success(function(data) {
Course.fields = angular.copy(data.actions.POST);
});
return Course;
}]);
......
......@@ -75,9 +75,6 @@
var messages = [];
for(var att in response.data) {
var message = response.data[att];
if(Course.fields && Course.fields[att]) {
message = Course.fields[att].label + ': ' + message;
}
messages.push(message);
}
$scope.alert.error('Encontramos alguns erros!', messages, true);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment