mirror of
https://github.com/YunoHost/yunohost-admin.git
synced 2024-09-03 20:06:15 +02:00
We don't need all that custom madness for the postinstall ...
This commit is contained in:
parent
1347589eec
commit
79fc66558c
2 changed files with 54 additions and 82 deletions
|
@ -101,6 +101,7 @@
|
|||
store.set('url', window.location.hostname +'/yunohost/api');
|
||||
store.set('user', 'admin');
|
||||
c.api('POST', '/postinstall', {domain: domain, password: password}, function() {
|
||||
c.flash('success', y18n.t('installation_complete'));
|
||||
c.redirect_to('#/login');
|
||||
});
|
||||
}
|
||||
|
|
|
@ -144,37 +144,9 @@
|
|||
|
||||
call = function(uri, callback, method, data, callbackOnFailure) {
|
||||
|
||||
var args = data;
|
||||
// TODO: change this code
|
||||
if (uri === '/postinstall') {
|
||||
var post_installing = false;
|
||||
setInterval(function () {
|
||||
post_installing = true;
|
||||
}, 1500);
|
||||
}
|
||||
|
||||
// Define default callback for failures
|
||||
if (typeof callbackOnFailure !== 'function') {
|
||||
callbackOnFailure = function(xhr) {
|
||||
// Postinstall is a custom case, we have to wait that
|
||||
// operation is done before doing anything
|
||||
//
|
||||
// TODO / FIXME : maybe we should add this as a
|
||||
// callbackonfailure during the actual api call instead
|
||||
// of hard-coding it here...
|
||||
if ((uri === '/postinstall') && (post_installing)) {
|
||||
interval = window.location.hostname === args.domain ? 20000 : 5000;
|
||||
checkInstall = setInterval(function () {
|
||||
c.checkInstall(function(isInstalled) {
|
||||
if (isInstalled || typeof isInstalled === 'undefined') {
|
||||
c.flash('success', y18n.t('installation_complete'));
|
||||
clearInterval(checkInstall);
|
||||
window.location.href = 'https://'+ window.location.hostname +'/yunohost/admin/';
|
||||
}
|
||||
});
|
||||
}, interval);
|
||||
}
|
||||
// Regular errors
|
||||
else {
|
||||
if (xhr.status == 200) {
|
||||
// Fail with 200, WTF
|
||||
callback({});
|
||||
|
@ -230,7 +202,6 @@
|
|||
// Force scrollTop on page load
|
||||
$('html, body').scrollTop(0);
|
||||
store.clear('slide');
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue