Smarter BACKEND_URL
This commit is contained in:
parent
c26b3d26d4
commit
0e3052e8eb
|
@ -6,6 +6,12 @@ Changelog
|
|||
------------------
|
||||
|
||||
|
||||
0.3.5 (2018-01-07)
|
||||
------------------
|
||||
|
||||
- Smarter BACKEND_URL in frontend
|
||||
|
||||
|
||||
0.3.4 (2018-01-07)
|
||||
------------------
|
||||
|
||||
|
|
|
@ -112,9 +112,8 @@ export default {
|
|||
selector.push('.autocomplete')
|
||||
settings.fields = f.autocomplete_fields
|
||||
settings.minCharacters = 1
|
||||
let backendUrl = config.BACKEND_URL || window.location.protocol + '//' + window.location.hostname + ':' + window.location.port
|
||||
settings.apiSettings = {
|
||||
url: backendUrl + f.autocomplete + '?' + f.autocomplete_qs,
|
||||
url: config.BACKEND_URL + f.autocomplete + '?' + f.autocomplete_qs,
|
||||
beforeXHR: function (xhrObject) {
|
||||
xhrObject.setRequestHeader('Authorization', self.$store.getters['auth/header'])
|
||||
return xhrObject
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
class Config {
|
||||
constructor () {
|
||||
this.BACKEND_URL = process.env.BACKEND_URL
|
||||
if (this.BACKEND_URL === '/') {
|
||||
this.BACKEND_URL = window.location.protocol + '//' + window.location.hostname + ':' + window.location.port
|
||||
}
|
||||
if (!this.BACKEND_URL.endsWith('/')) {
|
||||
this.BACKEND_URL += '/'
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue