Fixed JS errors on the login page

This commit is contained in:
Bernd Bestel
2019-09-21 08:25:32 +02:00
parent 78b658e86e
commit d580990b25
4 changed files with 43 additions and 23 deletions

View File

@@ -1,13 +1,16 @@
Grocy.Api.Get('system/db-changed-time',
function(result)
{
Grocy.DatabaseChangedTime = moment(result.changed_time);
},
function(xhr)
{
console.error(xhr);
}
);
if (Grocy.UserId !== -1)
{
Grocy.Api.Get('system/db-changed-time',
function(result)
{
Grocy.DatabaseChangedTime = moment(result.changed_time);
},
function(xhr)
{
console.error(xhr);
}
);
}
// Check if the database has changed once a minute
// If a change is detected, reload the current page, but only if already idling for at least 50 seconds,
@@ -56,7 +59,7 @@ setInterval(function()
Grocy.IdleTime += 1;
}, 1000);
if (BoolVal(Grocy.UserSettings.auto_reload_on_db_change))
if (Grocy.UserId !== -1 && BoolVal(Grocy.UserSettings.auto_reload_on_db_change))
{
$("#auto-reload-enabled").prop("checked", true);
}