Merge branch 'release/0.3.5'

This commit is contained in:
Eliot Berriot 2018-01-07 23:08:08 +01:00
commit c7d6ad95ec
No known key found for this signature in database
GPG Key ID: DD6965E2476E5C27
4 changed files with 11 additions and 3 deletions

View File

@ -6,6 +6,12 @@ Changelog
------------------ ------------------
0.3.5 (2018-01-07)
------------------
- Smarter BACKEND_URL in frontend
0.3.4 (2018-01-07) 0.3.4 (2018-01-07)
------------------ ------------------

View File

@ -1,3 +1,3 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
__version__ = '0.3.4' __version__ = '0.3.5'
__version_info__ = tuple([int(num) if num.isdigit() else num for num in __version__.replace('-', '.', 1).split('.')]) __version_info__ = tuple([int(num) if num.isdigit() else num for num in __version__.replace('-', '.', 1).split('.')])

View File

@ -112,9 +112,8 @@ export default {
selector.push('.autocomplete') selector.push('.autocomplete')
settings.fields = f.autocomplete_fields settings.fields = f.autocomplete_fields
settings.minCharacters = 1 settings.minCharacters = 1
let backendUrl = config.BACKEND_URL || window.location.protocol + '//' + window.location.hostname + ':' + window.location.port
settings.apiSettings = { settings.apiSettings = {
url: backendUrl + f.autocomplete + '?' + f.autocomplete_qs, url: config.BACKEND_URL + f.autocomplete + '?' + f.autocomplete_qs,
beforeXHR: function (xhrObject) { beforeXHR: function (xhrObject) {
xhrObject.setRequestHeader('Authorization', self.$store.getters['auth/header']) xhrObject.setRequestHeader('Authorization', self.$store.getters['auth/header'])
return xhrObject return xhrObject

View File

@ -1,6 +1,9 @@
class Config { class Config {
constructor () { constructor () {
this.BACKEND_URL = process.env.BACKEND_URL 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('/')) { if (!this.BACKEND_URL.endsWith('/')) {
this.BACKEND_URL += '/' this.BACKEND_URL += '/'
} }