Commit 5cbf8f28 authored by Ricco Førgaard's avatar Ricco Førgaard

Fixes yet another issue with config.

parent 8f6eeb58
......@@ -4,4 +4,4 @@ To get up and running:
$ bower install
$ open index.html
If your REST server expects a namespace on the URL path (such as `/api/study/list` instead of `/study/list`), add it to the `config/config.js`file. You can specify either a namespace (`/api/`) or a URL (`http://my-host:8080/api`).
If your REST server expects a namespace on the URL path (such as `/api/study/list` instead of `/study/list`), add it to the `config/config.js`file. You can specify either a namespace (`/api`) or a URL (`http://my-host:8080/api`).
define(['dojo/_base/declare'], function(declare) {
return declare('nesstarconfig.config', null, {
/* API URL namespace */
baseUrl: '/api/'
});
});
\ No newline at end of file
window.config = {
baseUrl: ''
}
\ No newline at end of file
define(['dojo/_base/declare',
'dojo/_base/lang',
'dojo/request',
'nesstarconfig/config'], function(declare, lang, request, config) {
'nesstarconfig/config'], function(declare, lang, request) {
return declare('nesstartouch._RestMixin', null, {
defaultOptions: {
method: 'GET',
......@@ -40,8 +40,12 @@ define(['dojo/_base/declare',
},
addBaseUrl: function(originalUrl) {
if (config) {
return config.baseUrl + originalUrl;
if (window.config) {
var base = window.config.baseUrl;
if (base.indexOf('/', base.length - 1) !== -1) {
base = base.substring(0, base.length - 1);
}
return base + originalUrl;
}
return originalUrl;
},
......
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