From 83127a5692fa6a8c25cb4599b613d6c6f05b574f Mon Sep 17 00:00:00 2001 From: opi Date: Mon, 27 Feb 2017 17:46:24 +0100 Subject: [PATCH] =?UTF-8?q?[fix]=C2=A0Guess=20API's=20baseurl=20is=20store?= =?UTF-8?q?=20is=20empty.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/js/yunohost/helpers.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/js/yunohost/helpers.js b/src/js/yunohost/helpers.js index b4279360..1c9e2a6a 100644 --- a/src/js/yunohost/helpers.js +++ b/src/js/yunohost/helpers.js @@ -43,9 +43,14 @@ }, checkInstall: function(callback) { + // Get base url from store or guess from current url + var baseUrl = (store.get('url') !== null) ? store.get('url') + : window.location.hostname + '/yunohost/api'; + + // Call API endpoint $.ajax({ dataType: "json", - url: 'https://'+ store.get('url') +'/installed', + url: 'https://'+ baseUrl +'/installed', timeout: 3000 }) .success(function(data) {