baseUrl esposto a QML come Q_INVOKABLE: fix TypeError su MainPage/SearchPage/BookDetailPage
This commit is contained in:
@@ -120,7 +120,7 @@ Page {
|
||||
function resolveUrl(u) {
|
||||
if (u.indexOf("http://") === 0 || u.indexOf("https://") === 0)
|
||||
return u
|
||||
var base = appSettings.baseUrl
|
||||
var base = appSettings.baseUrl()
|
||||
return base + (u.charAt(0) === "/" ? u : "/" + u)
|
||||
}
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ Page {
|
||||
}
|
||||
|
||||
function loadIndex() {
|
||||
var base = appSettings.baseUrl
|
||||
var base = appSettings.baseUrl()
|
||||
if (base.length === 0) {
|
||||
page.errorMessage = "Server non configurato"
|
||||
return
|
||||
|
||||
@@ -41,7 +41,7 @@ Page {
|
||||
}
|
||||
|
||||
function search() {
|
||||
var base = appSettings.baseUrl
|
||||
var base = appSettings.baseUrl()
|
||||
var query = searchField.text.trim()
|
||||
if (base.length === 0 || query.length === 0)
|
||||
return
|
||||
|
||||
+2
-2
@@ -34,8 +34,8 @@ public:
|
||||
// Header "Authorization: Basic ..." pronto da usare, vuoto se utente non impostato
|
||||
QString authHeader() const;
|
||||
|
||||
// URL del server senza slash finale
|
||||
QString baseUrl() const;
|
||||
// URL del server senza slash finale (usabile da QML come appSettings.baseUrl())
|
||||
Q_INVOKABLE QString baseUrl() const;
|
||||
|
||||
signals:
|
||||
void serverUrlChanged();
|
||||
|
||||
Reference in New Issue
Block a user