Merge pull request #217 from YunoHost/dont-run-initial-checks-everytime

Don't run initial checks each time home page is displayed
This commit is contained in:
Alexandre Aubin 2018-12-18 16:15:54 +01:00 committed by GitHub
commit b6aa675463
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3,6 +3,8 @@
var app = Sammy.apps['#main'];
var store = app.store;
var initial_checks_already_performed = false;
/**
* Home
*
@ -10,7 +12,11 @@
// Home page
app.get('#/', function (c) {
c.api('/users', function(data) {
if (initial_checks_already_performed)
{
c.view("home");
}
else c.api('/users', function(data) {
// Warn admin if no users are created.
if (typeof data.users !== 'undefined' && data.users.length === 0) {
c.flash('warning', y18n.t('warning_first_user'));
@ -77,6 +83,7 @@
}
});
initial_checks_already_performed = true;
c.view('home');
});
});