Don't run initial checks each time home page is displayed

This commit is contained in:
Alexandre Aubin 2018-12-11 00:16:59 +00:00
parent c0b7e55350
commit cf196d6458

View file

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