Commit c31a4fd0 authored by sim's avatar sim

[FIX] Annotations app work wether we use https or not

parent 1b66e9f0
...@@ -7,6 +7,12 @@ ...@@ -7,6 +7,12 @@
$httpProvider.defaults.xsrfHeaderName = 'X-CSRFToken'; $httpProvider.defaults.xsrfHeaderName = 'X-CSRFToken';
$httpProvider.defaults.xsrfCookieName = 'csrftoken'; $httpProvider.defaults.xsrfCookieName = 'csrftoken';
}]); }]);
function url(path) {
// adding explicit "http[s]://" -- for cross origin requests
return location.protocol + '//' + window.GARG_ROOT_URL + path;
}
/* /*
* DocumentHttpService: Read Document * DocumentHttpService: Read Document
* =================== * ===================
...@@ -98,9 +104,7 @@ ...@@ -98,9 +104,7 @@
*/ */
http.factory('MainApiAddNgramHttpService', function($resource) { http.factory('MainApiAddNgramHttpService', function($resource) {
return $resource( return $resource(
// adding explicit "https://" b/c this a cross origin request url("/api/ngrams?text=:ngramStr&corpus=:corpusId&testgroup"),
'https://' + window.GARG_ROOT_URL
+ "/api/ngrams?text=:ngramStr&corpus=:corpusId&testgroup",
{ {
ngramStr: '@ngramStr', ngramStr: '@ngramStr',
corpusId: '@corpusId', corpusId: '@corpusId',
...@@ -131,9 +135,7 @@ ...@@ -131,9 +135,7 @@
http.factory('MainApiChangeNgramHttpService', function($resource) { http.factory('MainApiChangeNgramHttpService', function($resource) {
return $resource( return $resource(
// adding explicit "https://" b/c this a cross origin request url("/api/ngramlists/change?list=:listId&ngrams=:ngramIdList"),
'https://' + window.GARG_ROOT_URL
+ "/api/ngramlists/change?list=:listId&ngrams=:ngramIdList",
{ {
listId: '@listId', listId: '@listId',
ngramIdList: '@ngramIdList' // list in str form (sep=","): "12,25,30" ngramIdList: '@ngramIdList' // list in str form (sep=","): "12,25,30"
...@@ -171,8 +173,7 @@ ...@@ -171,8 +173,7 @@
*/ */
http.factory('MainApiFavoritesHttpService', function($resource) { http.factory('MainApiFavoritesHttpService', function($resource) {
return $resource( return $resource(
// adding explicit "https://" b/c this a cross origin request url("/api/nodes/:corpusId/favorites?docs=:docId"),
'https://' + window.GARG_ROOT_URL + "/api/nodes/:corpusId/favorites?docs=:docId",
{ {
corpusId: '@corpusId', corpusId: '@corpusId',
docId: '@docId' docId: '@docId'
......
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