POST instantiation for Django-Angular
We currently need to include a CSRF token in our form if we want to POST to a Django view. This is cumbersome and should really be a global setting. Change-Id: I607a0e428833e7478b073eec4d9ef9e1e856ae12 Closes-Bug: #1395270
This commit is contained in:
parent
3ebc7ae825
commit
04ce53bcb3
5
horizon/static/horizon/js/angular/horizon.js
vendored
5
horizon/static/horizon/js/angular/horizon.js
vendored
@ -9,8 +9,9 @@ var horizonApp = angular.module('hz', dependencies)
|
||||
$httpProvider.defaults.xsrfCookieName = 'csrftoken';
|
||||
$httpProvider.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
|
||||
}])
|
||||
.run(['hzConfig', 'hzUtils', '$cookieStore',
|
||||
function (hzConfig, hzUtils, $cookieStore) {
|
||||
.run(['hzConfig', 'hzUtils', '$cookieStore', '$http', '$cookies',
|
||||
function (hzConfig, hzUtils, $cookieStore, $http, $cookies) {
|
||||
$http.defaults.headers.post['X-CSRFToken'] = $cookies.csrftoken;
|
||||
//expose the configuration for horizon legacy variable
|
||||
horizon.conf = hzConfig;
|
||||
horizon.utils = hzUtils;
|
||||
|
Loading…
x
Reference in New Issue
Block a user