[fix] Guess API's baseurl is store is empty.

This commit is contained in:
opi 2017-02-27 17:46:24 +01:00
parent d9f4904cc6
commit 83127a5692

View file

@ -43,9 +43,14 @@
}, },
checkInstall: function(callback) { 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({ $.ajax({
dataType: "json", dataType: "json",
url: 'https://'+ store.get('url') +'/installed', url: 'https://'+ baseUrl +'/installed',
timeout: 3000 timeout: 3000
}) })
.success(function(data) { .success(function(data) {