mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-25 20:46:48 +00:00
21 lines
593 B
JavaScript
21 lines
593 B
JavaScript
function AdminOrderCycleCtrl($scope, $http) {
|
|
$http.get('/admin/order_cycles/new.json').success(function(data) {
|
|
$scope.order_cycle = data;
|
|
});
|
|
|
|
$scope.submit = function() {
|
|
$http.post('/admin/order_cycles', {order_cycle: $scope.order_cycle}).success(function(data) {
|
|
if(data['success']) {
|
|
window.location = '/admin/order_cycles';
|
|
} else {
|
|
console.log('fail');
|
|
}
|
|
});
|
|
};
|
|
}
|
|
|
|
angular.module('order_cycle', []).
|
|
config(function($httpProvider) {
|
|
$httpProvider.defaults.headers.common['X-CSRF-Token'] = $('meta[name=csrf-token]').attr('content');
|
|
});
|